The mayor and Department of Environmental Protection officials will reveal Thursday that the city’s harbors are the healthiest they have been in more than a century.

The city said the waterways have shed bacteria, gained dissolved oxygen that marine life thrives on and experienced a drop in nitrogen, which deoxidizes the water, over the past decades.

Still, the agency’s annual harbor water quality report released in spring found dissolved oxygen levels in the water were above the state’s standard for when water is safe to drink or bathe in.

Mayor Bill de Blasio and DEP Commissioner Vincent Sapienza said the harbors have benefitted from upgrades to the city’s wastewater system, which prevent excess storm water and waste from flowing into the oceans.

“Anecdotal evidence of whales, dolphins and seals returning to New York Harbor abound, and our testing confirms that the water in New York Harbor is cleaner today than it has been in more than a century,” Sapienza said in a statement.

De Blasio said his $1.5 billion green infrastructure plan, which includes green roofs, gardens and other efforts to plant vegetation on impervious surfaces, has contributed to the improving water quality.

City Hall said it will have added 4,000 curbside gardens, which are designed to absorb rainwater, by the end of 2017. Under its green infrastructure plan, another 300 are slated to be built in 2018.