ExxonMobil XOM

A federal judge in Manhattan on Thursday dismissed Exxon's lawsuit claiming officials in New York and Massachusetts were pursuing bad faith investigations in violation of the oil giant's constitutional rights.

US District Judge Valerie Caproni called Exxon's position "implausible."

"Exxon has asked two federal courts—first in Texas, now in New York—to stop state officials from conducting duly-authorized investigations into potential fraud," she wrote. "It has done so on the basis of extremely thin allegations and speculative inferences."

Exxon maintained in the lawsuit that the attorneys general in New York and Massachusetts worked behind the scenes with environmental groups, who were attempting to promote litigation against fossil fuel companies. It also said the state officials tried to squash Exxon's right to free speech and dissenting opinions on climate change.

Exxon did not immediately respond to a request for comment about the ruling.

In a statement, New York Attorney General Eric Schneiderman, who opened an investigation into Exxon's historical knowledge of climate change in 2015, praised the decision.

He said the lawsuit "wrongfully attempted to thwart a serious state law enforcement investigation into the company."

Schneiderman and Massachusetts Attorney General Maura Healey are investigating whether Exxon, the world's largest publicly traded oil company, misled investors and the public about its knowledge of climate change and the potential effects that climate change may have on its business.

Harvard study: Exxon 'misled the public' on climate change for nearly 40 years

The attorneys general are looking into whether Exxon's past securities filings were misleading because they failed to disclose the company's internal projections regarding the potential costs of climate change and expected environmental regulations.

Exxon filed a lawsuit against the New York and Massachusetts officials in 2016, claiming the probes were part of a conspiracy to "silence and intimidate one side of the public policy debate on how to address climate change."

Exxon is also facing lawsuits from San Francisco, Oakland and other municipalities in California, which have demanded the company and its rivals pay billions of dollars to cover damage from looming sea level rise due to climate change.

Exxon gives up major climate change fight

Exxon argues that the California cities and counties have contradicted themselves by admitting in bond sales that climate change risks are unpredictable.

Federal law requires companies and governments to reveal risks to investors before selling securities like stock or muni bonds.

And in late 2017, after years of resisting, ExxonMobil agreed to reveal the risks it faces from climate change and the global crackdown on carbon emissions.

Exxon said the disclosures will include how the company is positioning for a lower-carbon future and how its business could be hurt by shifting energy demands.

--CNN's Jackie Wattles and Matt Egan contributed to this report