MOSCOW, JULY 17 -- At the eternal flame beneath the Kremlin wall, symbol of the 27 million Soviet dead of World War II, opinion was divided over the prospect of a united Germany's becoming a member of a hostile military alliance.

"It's normal. Why should we be worried?" said Dmitri Sidov, 22, who was escorting his bride-to-be today on a tour of Moscow. "This was not a war between Germany and Russia. It was a war between fascism and Stalinist-type communism. Both our countries have changed since then."

"Of course I'm concerned," said Alexei Ivanov, a 65-year-old war veteran from the western Soviet city of Brest, which was ceded to Germany in World War I and reclaimed after World War II. "I can accept that Germany should become one nation again. But why do they want to join an alliance that is opposed to us? I fear that history could repeat itself."

The clash of views at the eternal flame, a vivid reminder of the terrible losses suffered by the Soviet Union in what is referred to here as the Great Patriotic War, reflects a wider generational rift. Young people who have grown up since the country's last war tend to take a much more benign view of Germany than their parents, who still vividly remember the horror of the Nazi invasion.

Over the past few months, President Mikhail Gorbachev has gradually prepared the ground for an about-face on German membership in the North Atlantic Treaty Organization -- first flatly ruling it out, then indicating that it might be possible under certain circumstances. Monday, in talks with West German Chancellor Helmut Kohl, he finally conceded that a united Germany had a right to belong to any alliance it wished.

A similar evolution seems to have taken place in Soviet public opinion. Last year, most Soviets reacted with mixed incredulity and alarm to suggestions that their hereditary enemies could end up united as part of a hostile military alliance. But many have reluctantly come to accept the idea, viewing it as one of the stunning changes that have taken place in East-West relations.

Soviet commentators have emphasized the diplomatic and financial gains likely to accrue to the Kremlin now that the issue of German unification is finally on the way to being resolved. They have also sought to reassure the public that the Soviet Union has sufficient strategic and tactical nuclear weapons to forestall any thought of aggression by the West.

"There is nothing for us to be afraid of, even a united Germany. Nobody is threatening us. Nobody intends to attack us," wrote Alexander Bovin, the leading foreign-policy analyst for the government newspaper Izvestia. "The transfer of the GDR {East Germany} from one bloc to another will not have any significant impact on the level of Soviet security. Even though, naturally, it is upsetting."

Gorbachev is likely to have a more difficult time selling German NATO membership to senior generals, some of whom have been openly grumbling about too many "one-sided concessions" to the West. At last week's Communist Party congress, leaders of the armed forces were still publicly insisting that a reunited Germany should be neutral.

For the moment, however, Gorbachev appears to have succeeded in deflecting military concerns to the problem of providing adequate housing and living conditions for returning Soviet soldiers. Under the preliminary agreement reached with Kohl, about 360,000 Soviet troops will return from East Germany over the next four years.

The West German chancellor agreed to help Moscow meet these resettlement costs. German officials also have suggested that German construction companies might build homes for the military in the Soviet Union, easing what is undoubtedly the most sensitive social problem for Soviet officers. Army newspapers complained that some of the troops already withdrawn from Czechoslovakia and Hungary are being housed in tents, virtual refugees in their own country.

For most Soviet citizens, worries about East Germany defecting to NATO have been overwhelmed by the rapidly deteriorating economic situation at home. The wedding party paying their respects to the unknown soldier beneath the Kremlin wall found humor in the idea of German unification.

"If our leaders agree to East Germany uniting with West Germany, perhaps they will let the Soviet Union unite with the United States," joked Andrei Khripankov, the best man. "That would be one way of solving our economic crisis."

But an elderly lady from Astrakhan who fought in the Red Army during the war was not so sure. "The Germans were very friendly to Gorbachev when he visited them. But, deep down, I don't think they have changed. They have been our enemy since the time of the czars."