The Interior Department, in an action that will remove tens of thousands of acres of California farmland from production, announced yesterday that it will immediately shut off the flow of contaminated irrigation water to the Kesterson National Wildlife Refuge near Los Banos, Calif.

"We have no choice but to take this action," Carol Hallett, a representative of Interior Secretary Donald P. Hodel, told a stunned congressional panel in Los Banos.

According to Interior officials, the action will turn at least 42,000 acres of farmland back into desert right away.

It also raises doubt about the future of the western San Joaquin Valley, where 1.5 million acres of farmland are under irrigation -- about one-third of all irrigated land in the valley. While 42,000 acres are immediately threatened, Interior geologists have estimated that almost all of it will need drainage eventually if it is to remain productive.

The western San Joaquin valley is irrigated by water brought from the north by the federal Central Valley Project. Because clay beneath the soil prevents natural drainage, excess water -- tainted with salts and the toxic mineral selenium -- must be sent back north.

Much of it drains into Kesterson, which now is so saturated with toxic substances that it has become a death trap to birds that nest there. Despite a $500,000 program designed to frighten waterfowl away from the refuge, hundreds of birds have died from selenium poisoning or have produced grotesquely deformed chicks.

In a statement released here, Hodel said he also ordered the Bureau of Reclamation to take another look at drainage systems throughout its maze of irrigation projects.

The Kesterson refuge lies at the end of one of the bureau's most elaborate drainage systems, the San Luis Drain. The drainage project was halted more than 100 miles short of its proposed discharge point above San Francisco when federal construction funds ran out in the mid-1970s. As a result, agricultural wastewater originally destined for San Francisco Bay has been discharged into the refuge's 1,200-acre complex of ponds since the early 1980s.

The refuge is so heavily contaminated with selenium that California officials last month declared it a toxic dump and ordered Interior to clean it up within three years.

But Hallett said yesterday that the department decided to act immediately because of the possibility of criminal violations of international treaties intended to protect migratory waterfowl. Kesterson is in the middle of the Pacific Flyway, a path followed by millions of ducks, geese and other waterfowl during their seasonal shuttles between Canada and Mexico.

"There are conflicts between irrigation for the valley and the law against the taking of migratory birds," and resolving that conflict is a matter for Congress, Hallett said.

The decision landed like a bombshell on members of a House Interior subcommittee, which was meeting in Los Banos at the request of its chairman, Rep. George Miller (D-Calif.).

"Imagine yourself in a hearing room packed with farm interests and farmers," said Albert Meyerhoff, an attorney for the Natural Resources Defense Council who was scheduled to testify at the hearing. "You could almost see it in midair, that hot potato flying across the hearing room."

In Washington, Interior officials hastened to Capitol Hill to brief California lawmakers on the unexpected decision, which is expected to cost from $30 million to several hundred million dollars.

The action will require cutting off irrigation water to at least 42,000 acres adjacent to the San Luis Drain, closing the drain and plugging all the subterranean agricultural pipes that empty into it. Interior officials said the department had not decided how best to clean up the refuge itself. This could involve hauling thousands of tons of contaminated soil to a licensed hazardous-waste dump and then covering the site with compacted clay.

"There is a certain degree of shock," a Miller aide said. "This is certainly one of the more dramatic developments. It's a day of reckoning, but the warnings have been out there for some time."

Conservation groups and bay-area officials have long battled the San Luis Drain project, fearing that the agricultural wastewater would contaminate the Sacramento-San Joaquin Delta above San Francisco and eventually the bay itself.

Southern Californians entered the fray after biologists discovered that the selenium problem was not limited to Kesterson. High levels of selenium have been found in the Grasslands, privately owned hunting preserves adjacent to the refuge but receiving wastewater from other sources, and state officials suspect that selenium may already be making its way to the delta through natural sloughs and creek beds.

The state pumps water from the delta into the California Aqueduct, which carries fresh drinking water to Los Angeles.

It was unclear how Interior's abrupt decision will affect spring planting in the 42,000 acres that drain into Kesterson. "I don't know if they'd farm with the prospect of no water or not," said Interior spokesman Bob Walker.

Farmers in the threatened area, however, already have signaled their intention to go to court against any attempt to cut off their water. "The Bureau of Reclamation promised to deal with drainage when it brought the water in," said Darrell Silveira, whose 3,000 acres lie in the cutoff area.