New York City’s rates of sexually transmitted diseases like chlamydia, gonorrhea and syphilis have hit the highest levels since the 1980s, but new cases of HIV have actually fallen by more than 30 percent over the last five years.

To contain the outbreak and push the HIV rate even lower, Mayor Bill de Blasio’s administration is proposing to spend more public money than in recent memory, according to the New York City Independent Budget Office.

The mayor’s $84.7 billion proposed budget for the upcoming fiscal year allocates about $25.7 million for the city health department’s Bureau of Sexually Transmitted Disease Control, according to the budget office.

The money is funding longer hours at the city’s STD clinics, increasing the number of body parts the clinics can swab and expanding the distribution of the HIV-prevention medicine Truvada for pre-exposure prophylaxis, said Dr. Jay Varma, deputy commissioner for disease control.

Varma said funding for STD programs went down in the aftermath of the Great Recession. When measured in inflation-adjusted dollars, spending fell about 20 percent between 2007 and 2016, the budget office said.

The total number of STD cases hit 81,399 in 2015, the latest year for which statistics are available, compared to 52,113 in 2006, according to the budget office.

In 2006, out of 100,000 New Yorkers, about 515 had chlamydia, 129 had gonorrhea and 7 had syphilis. In 2015, 742 had chlamydia, 199 had gonorrhea and 18 had syphilis, according to the budget office.

The number of STD diagnoses is higher than they’ve been in decades nationwide, too.

Of the latest spike, syphilis is one of the STDs with which officials are “most concerned,” Varma said. The disease can “lead to very serious health problems” if left untreated and have “devastating” effects if passed to a baby.

Higher-than-average STD rates are seen in men who have sex with men, including blacks and Latinos, officials said. The city health department is focusing on those groups to encourage testing, treatment, and the use of condoms and Truvada for pre-exposure prophylaxis.

Frustrating efforts to combat STDs is the widespread use of location-based hookup apps like Grindr, Varma said. Investigators trying to track down an infected person’s sexual partners can no longer rely on visiting a bathhouse or a bar, since many encounters begin online, he added.

“We consider those apps to be like a virtual bathhouse,” Varma said, but “people are less likely to know the names” or have reliable contact information for those partners from the apps.