A lawsuit targeting five of the world’s biggest oil companies over climate change that Mayor Bill de Blasio announced with much fanfare in January was tossed Thursday by a Manhattan judge.

The suit charged BP, Chevron ExxonMobil, ConocoPhillips and Royal Dutch Shell with harming the city by contributing to global warming and damaging climate events — including Superstorm Sandy — through the emission of greenhouse gases.

Manhattan Federal Court Judge John Keenan rejected the claim, saying international policy and political implications put the issue outside the court’s jurisdiction.

“Climate change is a fact of life, as is not contested by Defendants. But the serious problems caused thereby are not for the judiciary to ameliorate,” he wrote. “Global warming and solutions there to must be addressed by the two other branches of government.”

National Association of Manufacturers President Jay Timmons noted that it was the third major climate change lawsuit filed on behalf of a US city that has been dismissed.

“From the moment this baseless lawsuit was filed, manufacturers have argued that the courtroom was not the proper venue to address this global challenge,” he said.

“Now that San Francisco, Oakland and New York City have had their cases dismissed, the other municipalities should withdraw their complaints to save taxpayer resources and focus on meaningful solutions.”

City Hall officials said they plan to appeal to hold the polluting oil firms “accountable for their contributions to climate change and the damage it will cause New York City.”