WASHINGTON—A federal judge on Wednesday threw out federal approval of a multibillion-dollar oil project planned for Alaska, saying the government failed to properly assess the project’s impact on climate change and its potential harm to polar bears.

The ConocoPhillips Willow project in a federal oil reserve in the North Slope had been backed by both the Biden and Trump administrations, and comes with wide support from Alaskan political leaders. Republican Gov. Mike Dunleavy criticized the decision Wednesday night, saying it put thousands of potential jobs at risk.

U.S. District Judge Sharon Gleason agreed with challengers who argued that the Bureau of Land Management didn’t fully account for the greenhouse gases that would come from burning the oil Willow would produce, among other issues. The plaintiffs, led by the Center for Biological Diversity, included several environmental and Alaskan groups.

“As to the errors found by the Court, they are serious,” Judge Gleason, an Obama appointee seated in Anchorage, wrote in her 110-page decision.

ConocoPhillips will be reviewing the decision and evaluating its options, a spokesman said. The company declined to answer further questions.

Company leaders had been encouraged this spring when the Biden administration decided to defend the Trump-era decision to permit the project. But Conoco’s final investment was always dependent upon whether the company could navigate tricky and potentially lengthy court challenges at a time when oil markets aren’t particularly friendly to major spending in Alaska.

Willow is planned as a 160,000-barrel-of-oil-a-day, 30-year project, drilling from on top of permafrost in the federal government’s National Petroleum Reserve in Alaska.

The Trump administration gave it final approval in October, but the Ninth U.S. Circuit Court of Appeals halted the project this year, siding with challengers who said Willow was approved without proper analysis of environmental impacts.

Judge Gleason Wednesday again ruled that the Bureau of Land Management hadn’t given the full consideration to alternatives to Conoco’s plans that the law requires.

The governor, Mr. Dunleavy, accused the courts of intentionally making challenges to Alaskan drilling even bigger. He said Wednesday’s ruling could make the country more dependent on foreign oil.

“Make no mistake, today’s ruling from a federal judge trying to shelve a major oil project on American soil does one thing: outsources,” Mr. Dunleavy said in a statement. “This is a horrible decision.”

The Biden administration had supported the Trump administration’s analysis in court, which pleased important lawmakers from Alaska and several Western states. But the move had also drawn opposition from environmental groups, some of which said on Wednesday that they were hoping the new decision would lead the administration to reconsider its stance.

“We are hopeful that the administration won’t give the fossil fuel industry another chance to carve up this irreplaceable Arctic landscape with drilling rigs, roads, and pipelines,” said Jeremy Lieb,” an attorney with Earthjustice, which brought the case on behalf of the Center for Biological Diversity and other plaintiffs. “We should keep Arctic oil in the ground if we want a livable planet for future generations,” he said.

Write to Timothy Puko at tim.puko@wsj.com