MOSCOW (AP) _ In a bid to protect the native language, the tiny republic of Estonia has decreed that all Russians and other non-natives who work in stores, government or other service jobs learn Estonian in four years.

The restive Baltic republic's legislature voted on Wednesday by 204-50, with six abstentions, to adopt the unprecedented law, said Felix Undusk, a commentator for state-run Estonian television. People who fail to comply will lose their jobs, he said.

It was another pioneering move by Estonia's legislature, which in November challenged the central government in Moscow by declaring sovereignty over all but foreign affairs.

There was no immediate reaction from the Kremlin to Estonia's latest action. Official Soviet media reported on the new law, but did not mention the sanctions against workers who do not learn Estonian.

Radio Moscow said the republic's Supreme Soviet adopted a law making Estonian the official language but that the law ''points out that such a status does not infringe on the rights of people whose mother tongue is not Estonian.''

Estonia's standard of living, enviably high by Soviet standards, has led to an influx of immigrants, and many Estonians fear they will one day be outnumbered in their own homeland.

About 65 percent of Estonia's population of 1.5 million is ethnic Estonian. Russians make up 28 percent, Ukrainians 3 percent and Byelorussians 2 percent.

''This law means that if I go to the doctor, or ask a policeman where the post office is, I can get an answer in Estonian,'' Undusk said in a telephone interview from Tallinn, the Estonian capital. ''For Estonians, this is important. This is the only place in the world where our language is spoken.''

Undusk said there had been ''a great deal of immigration in past years, and there are people who work in post offices, medical clinics and factories who don't speak Estonian and have never tried.''

''This law will change that by requiring them to learn the language. If they don't after four years, they will have to leave their jobs.''

He said another provision of the law requires all goods sold in the republic to be labeled in Estonian.

Tass, the official news agency, said the law also requires that legal proceedings and records at Estonian offices and factories be in Estonian.

Russian traditionally has been the common language among the more than 100 nationalities of the empire the Bolsheviks captured from the czars.

Many citizens of Estonia, an independent nation forcibly absorbed by the Soviet Union in 1940 with its neighbors Latvia and Lithuania, refuse to learn Russian or use it only when necessary.

Undusk, who attended Wednesday's legislative session, said the republic would finance Estonian-language courses and print instruction manuals for ethnic Russians or others who must learn the language.

Most government documents in Estonia were written in Russian until 1987 and the republic's former Communist Party chief knew little Estonian. He was replaced last summer by a reformer and a native of the republic, Vaino Vyalyas.

A constitutional amendment passed last month made Estonian the official language, but legislators postponed a vote on requiring foreigners to learn it.

When Estonia declared sovereignty in November, the Presidium of the Supreme Soviet in Moscow - the nation's top executive body - declared the action illegal. But Estonian lawmakers say their own constitution outranks Presidium decrees.