ANAHEIM, Calif. — President Obama, appearing emboldened after his recent move to cut carbon emissions from coal-fired power plants, on Saturday ridiculed members of Congress who deny climate change or plead scientific ignorance as an alibi for avoiding an uncomfortable truth.

Speaking in gleefully sarcastic terms to a commencement ceremony at the University of California, Irvine, Mr. Obama likened those who deny climate change to people who would have told John F. Kennedy, at the dawn of the space program, that the moon “was made of cheese.”

He saved his most scathing words for lawmakers who say they are not qualified to judge the issue because they are not scientists. These people, the president said, recognize the truth but will not utter it for fear of being “run out of town by a radical fringe that thinks climate science is a liberal plot.”

“I’m not a scientist either,” Mr. Obama told this young audience, “but we’ve got some good ones at NASA. I do know the overwhelming majority of scientists who work on climate change, including some who once disputed the data, have put the debate to rest.”