DENVER  A college student who bid on and won more than $1.8 million in federal oil and gas leases last year without the intent or ability to pay will not be allowed to argue in court that he acted out of necessity to protect the environment, a federal judge ruled on Monday.

The student, Tim DeChristopher, 27, an economics major at the University of Utah, faces up to five years in prison and huge fines on each of two felony charges  making false statements and interfering with an auction  arising from the sale last December in Utah.

He has said he believed the looming dangers of climate change and environmental impact from drilling were so great and urgent that he had no choice but to take whatever action he could to stop the drilling program. His lawyer, Ronald J. Yengich, recently asked that the jury be allowed to consider a defense of necessity, or “choice of evils,” when the trial begins, perhaps early next year.

But Judge Dee Benson said in his ruling that Mr. DeChristopher had not met the threshold requirements under federal law.