A federal judge has rejected a Reagan administration proposal to relax rangeland grazing policy for more than 150 million acres of public land in western states.

The decision by U.S. District Court Judge Raul Ramirez in Sacramento, Calif., represents a major defeat for the administration and ranchers who sought more discretion about when and where cattle could be grazed.

In his order, filed last week, Ramirez prohibited the Interior Department and its Bureau of Land Management from relaxing rangeland controls.

"The apparent goal and inevitable result," he said, "is to allow ranchers, for a term of at least 10 years, to rule the range as they see fit with little or no governmental interference."

Ramirez said the proposed agreements with ranchers "violate the spirit and letter of federal laws which are intended to preserve and improve" rangeland. He noted that Congress enacted tough rangeland control laws because "it found substantial evidence of rangeland deterioration" where ranchers had free rein.

Environmental groups welcomed the ruling.

"We consider it a complete victory," said David Edelson of the Natural Resources Defense Council, which spearheaded the suit to block the policy. Edelson said the policy was the legacy of former Interior secretary James G. Watt.

But government officials and ranchers expressed disappointment.

"We were talking about agreements with ranchers who had good track records as stewards of the land," said Dick Johnson of the BLM office in Sacramento. He said the 10-year agreements would have given ranchers more flexibility in grazing decisions without eliminating BLM control.

A.W. Pratt of Glasgow, Mont., who grazes 400 head of cattle on 18,000 acres of public land, said the change would have given him more discretion in moving his herd from range to range.

"You're not pinned down as much -- you can move cattle earlier or later, depending on the situation," he said. Pratt said existing regulations give him little leeway, "and that can get tough when the weather is bad."