MOSCOW, FEB. 5 -- The Soviet Union today officially announced the legal rehabilitation of Nikolai Bukharin, Alexei Rykov and 18 other prominent Bolshevik leaders, 50 years after they were tried as "enemies of the people" and executed during Joseph Stalin's purges.

Foreign Ministry spokesman Gennadi Gerasimov told a news conference that evidence at the 1938 show trials had been "gathered illegally" and "facts had been falsified." He added, "I do think we are witnessing a grand and noble deed -- the restoration of their good names."

Gerasimov added that the decision was "only the beginning," adding that "there are many more people, a great many documents to be examined. It will take time."

Gerasimov said the Supreme Court met yesterday and a commission set up by Soviet leader Mikhail Gorbachev to study the possibility of rehabilitating leaders persecuted during the leadership of Stalin endorsed the court's decision today.

The decision to clear Bukharin of all legal charges is considered especially important to Gorbachev's economic reform program and his effort to de-Stalinize the political system. After the civil war that followed the 1917 revolution, Bukharin was a prominent supporter of the New Economic Policy, a program of limited private enterprise that resembles many of Gorbachev's own reform plans.

According to Gerasimov, the commission also had been considering but rejected the case of Genrikh Yagoda, a former head of the secret police who helped start the purges and was then dismissed by Stalin for "slackness." He was tried along with those who were rehabilitated today.

The process of rehabilitating leaders from the past will continue, Gerasimov said, and, according to historian Yuri Afanasyev, it may even include such long forbidden names as Leon Trotsky. It is Bukharin, though, who has the most immediate value for the Soviet leadership.

"Bukharin's views are probably the closest thing to providing a theoretical justification for perestroika," a senior western diplomat said, referring to Gorbachev's policy of economic restructuring. Bukharin, he said, provides Gorbachev "with a line of legitimacy."

Gerasimov said the issue of Bukharin's possible posthumous political rehabilitation within the Communist Party is an open issue. He said the commission is still discussing his ideas.

Gorbachev himself has been rumored to be head of the commission, but Gerasimov would not comment except to say the chairman was "of a very high level."

Bukharin, whom Lenin had once called "the favorite of the whole party," was falsely accused by Stalin of heading an anti-Soviet conspiracy of assassination and sabotage.

When Stalin came to power he put an end to the New Economic Policy, calling it "rotten liberalism." In 1929, he ousted Bukharin from the Communist Party for the crime of arguing against Stalin's collectivization of agriculture and rapid industrialization. For his relative moderation, Bukharin was known as a "right deviationist."

Rykov, who was commissar for internal affairs in the first Bolshevik government and was later Stalin's prime minister, also fell into disfavor for opposing collectivization, a program that led to mass deportations, famine and millions of deaths, especially in the Ukraine.

To many European Communists and Soviet reformers, Bukharin has traditionally represented a non-Stalinist alternative. Although he never endorsed political democratization or a multiparty system, Bukharin argued for a more gradualist, humane approach to socialism.

Roy Medvedev, a leading Soviet independent historian, said, "if Bukharin had headed our party after Lenin instead of Stalin, neither collectivization in its Stalinist form nor the terror of the 1930s and 1940s would have occurred."

In contrast to Stalin, Bukharin advocated that the Soviet Union should "grow into socialism" through limited private sector enterprises.

According to his wife, Anna Larina, just before he was killed, Bukharin wrote a "last testament" that he instructed her to memorize and then destroy. In it he appealed to future leaders for exoneration, saying, "Know, comrades, that on the banner you will carry in your victorious march to communism there is a drop of my blood."

Bukharin's widow, 72, ill and living on a small pension in Moscow, did not reveal any of the testament until March 1961, when a government committee in charge of rehabilitations called her in for questioning.

Although Larina and her son Yuri's living conditions improved in the 1960s, Soviet leader Nikita Khrushchev did not rehabilitate Bukharin. The only positive public comment was an informal remark by Pyotr Pospelov, a Central Committee member, who was friendly with Khrushchev. At a conference of historians he said, "Neither Bukharin nor Rykov was, of course, a spy or a terrorist."