The Reagan administration ceremoniously restored to California yesterday hundreds of millions of dollars of federal aid halted by the Carter administration as punishment for clean-air violations.

Environmental Protection Agency administrator Anne M. Gorsuch announced at a press conference in Los Angeles that the federal government is ending its freeze on aid to California for highway and sewer construction because the state has met certain federal air requirements.

Gorsuch was accompanied by Rep. William E. Dannemeyer (R-Calif.), an outspoken opponent of applying federal sanctions to force state cleanups.

Gorsuch said the money is being restored because California last month enacted an adequate inspection program, requiring emissions tests of most cars and trucks every two years.

Some administration officials said privately, however, that the announcement less than a month before the elections was also aimed at helping Republican congressional candidates.

The ban was imposed two years ago by the Carter administration after California disobeyed the Clean Air Act requirement of auto-emission inspections to control pollution in major urban areas.

Up to $850 million was affected, halting freeways, street extensions and other development, and prompting well-publicized feuds between state and federal officials.

Only about $150 million was actually withheld, state officials said,because waivers were obtained for projects linked to public health and safety.

"There's every justification for doing this now, but I'm not going to lie and say there was no political consideration," said an administration official who asked to remain anonymous.

"Imposing sanctions is never very popular and lifting them will certainly be popular, especially with the economy so down."

Gorsuch noted yesterday that the Reagan administration opposes the use of sanctions such as those imposed on California.

"I'm pleased to be able to take this action," Gorsuch said at the press conference at the Biltmore Hotel.

"I continue to feel that an inflexible, mandatory use of sanctions by the federal government against states is inappropriate and counterproductive as part of our national effort to clean up the air.

"Now that the state has done its part to comply with these requirements, we are happy to do ours."

The administration has proposed loosening the present sanctions on states and communities that don't enact emission inspections in highly polluted areas.

Dannemeyer helped lead the so-far-unsuccessful fight in the House Energy and Commerce Committee for this and other Reagan-supported changes in the Clean Air Act.

Because of Dannemeyer's role, environmentalists criticized Gorsuch for appearing with him yesterday to announce a "victory" for the clean-air cause.

"That's like announcing a rape prevention award and giving it to Jack the Ripper," said Carl Pope, a Sierra Club lobbyist in San Francisco.

A spokesman for Dannemeyer said the congressman supports clean air but does not believe in using a "federal hammer" to force states to adopt inspection programs as opposed to other cleanup measures.

California was the only state that lost federal highway and sewer grants for not inspecting emissions in polluted urban areas.