LOS ANGELES, DEC. 19 -- The federal government, in a landmark settlement, agreed today to give temporary legal status to an estimated 500,000 undocumented Salvadoran and Guatemalan immigrants and reconsider political-asylum requests from those nationalities that have been rejected since 1980.

The agreement appeared to end a massive 1985 lawsuit filed by more than 80 religious and refugee organizations and known as the American Baptist Churches case. It marked the most significant legal victory by the American sanctuary movement, a loosely knit organization of churches and civil rights workers formed in 1982 to protect Central American refugees.

The settlement halts all deportations or deportation hearings of Salvadorans and Guatemalans and requires the Immigration and Naturalization Service (INS) to give them work permits until newly filed asylum applications can be considered.

"It is the best Christmas present that I have heard of in a long time," said the Rev. John Fife, a minister in Tucson who was among eight movement activists convicted in 1986 of helping to smuggle Central American refugees into the United States from Mexico.

Several hundred U.S. churches declared themselves sanctuaries for such immigrants, who said they would be killed or tortured if deported to countries torn by insurgencies.

In the Washington area, the settlement is expected to affect between 15,000 and 20,000 people, said Daniel A. Katz, executive director of the Central American Refugees Center, who became involved in the case as part of the sanctuary movement in Texas. He called the agreement "an incredible victory for Salvadorans and Guatemalans in this country."

Attorneys estimated that as many as 150,000 refugees, whose asylum requests have been denied or are pending, could apply again. They said 350,000 would be encouraged to request asylum for the first time.

"This is a major victory for all Salvadorans and Guatemalans in this country whose claims for political asylum were being summarily denied for purely foreign policy reasons," said Marc Van Der Hout, an attorney for the National Lawyers Guild who led the legal chal-

lenge. "Never before has the INS agreed to readjudicate 150,000 cases."

A Justice Department spokesman called the settlement, signed by U.S. District Judge Robert F. Peckham in San Francisco today, a "fair agreement" but declined to comment further until a hearing Jan. 31 to consider reaction from other affected parties.

Justice Department officials said the government agreed to settle after losing several dismissal motions and concluding that the expense of an unfavorable decision would only increase as more refugees arrived.

The suit accused the federal government of violating the U.S. Refugee Act of 1980, which bars ideological considerations in the asylum process.

Attorneys for the plaintiffs said the refugees had a "well-founded fear" of persecution from their governments or right-wing death squads because of ties to unions and political-reform groups. INS and the State Department rejected their asylum applications, the suit charged, to avoid embarrassing Salvadoran and Guatemalan governments friendly to Washington.

Sanctuary movement leaders have called for an end to U.S. military support for counterinsurgency efforts in Central America. But their efforts to introduce evidence about atrocities in Central America in refugee-smuggling trials have had only mixed success.

INS officials and federal attorneys have said the vast majority of undocumented Salvadorans and Guatemalans were not escaping political persecution but unemployment, poor economies and the general disruption and danger of war and thus do not quality for asylum. One study, disputed by refugee groups, buttressed U.S. claims that few Central Americans were harmed by government or death-squad action when forced to return home.

Under the settlement, the government agreed to put $200,000 in a special fund administered by refugee advocacy groups to alert Salvadorans and Guatemalans by mail, leaflets, television, radio and other means of how to apply for legal status.

The outreach program is expected to focus on Washington, Los Angeles, New York, San Francisco, Miami, Houston, Dallas and Chicago.

"It is important to get the word out to refugees and refugee organizations," said Morton Stavis, president of the Center for Constitutional Rights, which helped to bring the suit.

Except for those convicted of certain felonies, all Guatemalans in the United States as of Oct. 1 and all Salvadorans here as of Sept. 19 are covered by the settlement. Salvadorans must apply for legal status between Jan. 1 and June 30 and Guatemalans between July 1 and Dec. 31.

Salvadorans who register for temporary protected status under a new immigration law passed this year also will be covered.

Attorneys for the refugees said fewer than 3 percent of Salvadorans and fewer than 1 percent of Guatemalans have been granted asylum, while the percentages for refugees from less friendly countries such as Iran are much higher.

The attorneys noted that the INS gave special consideration to applicants from Nicaragua when theirs was the only Central American government at odds with the United States. The settlement promises that asylum cases now will be handled by "a newly trained corps of asylum officers."

The government acknowledges in the settlement that "foreign policy and border enforcement considerations, the government's opinion of the political or ideological beliefs of the applicant and the fact that an individual is from a country that the United States supports politically are not proper factors in determining eligibility for asylum."

Fife, in a telephone interview from Tucson, said Guatemalans and Salvadorans are crossing the border in numbers greater than in any year since 1983. The settlement, he said, "is a vindication for the sanctuary movement," and activists in Arizona plan a celebration Sunday.

In Washington, Katz and heads of other local community-based organizations are predicting that the settlement, coupled with the new immigration provisions effective in January, will inundate community agencies.

"We're going to have to do a massive education and recruitment drive," said Yvonne Vega, executive director of Ayuda Inc., a legal services agency that caters to Spanish-speaking clients.

Staff writers Sharon LaFraniere and Carlos Sanchez in Washington contributed to this report.