VIENNA, NOV. 6 -- In the fall of 1950, Zdenek Mlynar, then an ambitious young activist of the Czechoslovak Communist Party, was included in an elite group of students sent to Moscow to spend five years studying law and building up Soviet contacts.

Though the assignment was prestigious, conditions in Moscow proved daunting. Students at Moscow State University's law faculty were corralled eight to a room in a huge former Army barracks dating from the time of Peter the Great. And with the totalitarianism of Joseph Stalin still gripping the country, Soviet youth generally kept their distance from visiting foreigners.

Mlynar, however, found that one of his fellow Soviet students seemed unfazed either by his Czech origin or by the pervasive terror of Stalinism. This was a strapping, self-assured former farmhand named Mikhail Gorbachev, who quietly refuted official propaganda about conditions in his native Stavropol, objected to the executions of Stalin's political enemies and gallantly courted a charming friend from the women's side of the dormitory despite the onerous lack of privacy.

Mlynar was the first foreigner Gorbachev had ever met. Nevertheless, the two young men soon formed a friendship that mixed student comradeship with a fervently shared conviction that communism could solve the problems of the world under the guidance of a new postwar generation.

Today, the story of the two friends provides an elliptical trace of the paths followed by that wave of communist leaders amid years of stagnation in the Soviet Union and the stamping out of reform movements in Eastern Europe. It offers the picture of Gorbachev as a self-made man and tough-minded pragmatist who was committed to deep changes in Soviet communism for two decades before he could initiate them as Kremlin leader.

From his quiet exile in an academic institute here, the gray-haired Mlynar, who rose to become the Central Committee secretary under Czech Communist leader Alexander Dubcek, now watches as his old friend revives the ideals of economic decentralization and pluralism for which he and other Czech leaders were purged following the 1968 "Prague Spring," Czechoslovakia's short-lived experiment with liberalization that was crushed by a Soviet-led invasion.

"Gorbachev is a man who is capable of throwing out dogmas that have been in effect for decades," he said. "I trust him."

As Mlynar tells it, the Soviet leader shared the reformist spirit, if not the detailed agenda, of the Czech communists in the 1960s. At their last face-to-face meeting, in Stavropol in May 1967, Mlynar said a sympathetic Gorbachev, then secretary of the Stavropol party committee, listened to his old friend explain the emerging ideas for creating "socialism with a human face" in Czechoslovakia. He then expressed his frustration with the lack of reforms in the Soviet Union.

In their private talks, Gorbachev approved of the removal of Soviet leader Nikita Khrushchev, Mlynar said, not for Khrushchev's opposition to Stalinism but because he had not gone far enough in dismantling the centralized, Stalinist system of management. "He said they were still being told by Moscow what sort of agricultural products to produce in Stravropol even though the Moscow people didn't know anything about their affairs," Mlynar said.

Moreover, Gorbachev asserted to Mlynar that Leonid Brezhnev, only then consolidating his power as Khrushchev's successor, was "a transitional figure" who lacked a clear conception of how to lead the Soviet Union away from Stalinism. Brezhnev, Gorbachev predicted incorrectly, would be replaced within one or two years by a new leader who would inaugurate a program of decentralizing the economy as well as political authority.

Mlynar regards Gorbachev's survival of the following era of retrenchment -- a time that saw the political destruction of Mlynar and other like-minded leaders in Eastern Europe -- as proof of his friend's political skill. "Gorbachev knows the dangers {of Soviet politics} better than most of the journalists who advise him think," he said.

"If he could live under Brezhnev for 18 years with these exceptional ideas and then come to the top, that's proof that he is a man who knows what steps he can afford to take," Mlynar said.

That Gorbachev was willing to speak so freely to his old Czech comrade, Mlynar said, simply confirmed qualities of openness and buoyant self-assurance that were evident from the beginning of their student days. "First of all, Gorbachev always put great weight on what he personally experienced and what he saw and felt, and preferred that to what he read on paper," he said. "And he was always forthright."

For both men, conditions in Moscow were trying. The huge converted Army barracks where they lived with thousands of other students was still run with military austerity, with communal bathrooms and kitchens and eight beds to a room. The heavily regimented law school schedule required up to 36 hours a week of classes and seminars, and most of the rest of the students' time was spent studying in the library or preparing meals in the dormitory. "A trip to a coffeehouse was totally impossible financially," Mlynar remembers with a grin.

Romance was also difficult in the cramped conditions, but Mlynar says Gorbachev soon came to know Raisa, a law student who lived in the women's section of their dormitory and whom Gorbachev married in 1954. Because of the severe shortage of housing, Mlynar said, Gorbachev and his wife were obliged to live separately even after they married. "Gorbachev lived in his room with seven men, and she lived in her room with seven women," he said.

As it happened, Gorbachev, a man of 19 in 1950 who sometimes wore the pin he was awarded for collective farm work back home, and Mlynar, the young intellectual from Prague, were quartered in rooms across the corridor from each other.

"Gorbachev was completely open to me. It made no difference to him that I was a foreigner. And that was unusual at the time, because many Soviet students were afraid of us. They didn't know who we were or what we were doing there."

Moreover, Mlynar said he was attracted to the young Russian because "Gorbachev took Marxism very seriously, as I did. We were convinced that Marxism was the final answer that would change the world. And that was also a rare thing among Soviet students."

During the summer vacation after their first year in school, Mlynar, in Prague, sent a friendly postcard to Gorbachev, who was back working on the collective farm in his home village near Stavropol. It was the first piece of mail that Gorbachev had ever received from abroad, and it created such a stir in his hometown that the local police chief personally went to the field where Gorbachev was working to deliver it.

While the two friends laughed about this incident when they were back in Moscow, Mlynar says, Gorbachev also startled him with remarks that questioned the then-unquestionable Stalinist orthodoxy. When students were told that enemies of the party must be executed and "erased from history," Gorbachev told Mlynar that he preferred the example of Lenin, who merely exiled enemies.

Though a mild remark, it was a confession that could have destroyed the young Russian's career, had Mlynar reported it.

Mlynar said that when they studied the law on collective farming, Gorbachev told him from personal experience that in practice "maintaining work discipline" meant simply the use of force. When they watched a propaganda film about the Cossacks of Caucasia, showing tables of food, Gorbachev was quick to point out that in fact food was often in short supply at home.

The Czech believes that it was this kind of honesty, combined with the powerful assurance of a self-made man, that eventually led Gorbachev to his radical version of reformism. As to whether his old friend will be able to win the battle for change that was lost in Prague, Mlynar has an open mind.

"I am very happy" with suggestions from Moscow this week that it may be time for a reexamination of the Prague Spring, Mlynar said. "I have waited for that for 20 years. But so far it's not sure. We have to see what it leads to."