For more than a year, the Soviet Union has been building up to the celebration of the 40th anniversary of the end of World War II, a key event on its political calendar.

But as May 9 -- the day when peace in Europe was announced here in 1945 -- approaches, a diplomatic standoff has developed over whether the Soviets' western World War II allies will join in the event.

The Soviets have yet to announce just how "Victory Day" will be celebrated in Moscow, whether by a military parade with political overtones or a milder "demonstration" of civilians and veterans, as was done 10 years ago for the 30th anniversary.

Nor have they so far formally asked the United States, France, Britain or other western members of the World War II alliance against Hitler to send official delegations.

In 1975, the western allies were invited and did send representatives to the May 9 celebrations here. The U.S. group was headed by W. Averell Harriman, who served as U.S. ambassador during the war, and the British by Lord Mountbatten.

This time, until they know what they are being asked to join, several western countries are unsure how their governments will respond, if and when the invitations do come.

"We don't know what the Soviets have in mind," said one western diplomat. "Only after they decide what they intend to do will we decide ourselves."

Recent reports that a military parade, including regiments from at least some Eastern European countries, will be part of the May 9 celebrations have made some western countries even more dubious about attending if asked. "At this point, I would recommend against it," said one western diplomat recently.

The issue for the western members of the World War II alliance is the spirit in which the Soviets choose to honor the allied defeat of Fascist Germany. And while other, more immediate problems rank higher on the East-West agenda, the question of the 40th anniversary goes to the heart of enduring political differences between the two blocs.

It involves questions of the interpretation of postwar settlements, namely the division of Europe, views on the contributions of the various allies to the war effort and, finally, the deployment of the war theme in the context of the current international situation.

The western allies this year have sought to make the theme of the 40th anniversary a celebration of postwar peace and reconciliation between former enemies.

For the Soviet Union, the war is seen in a different light. As the nation that bore the brunt of the fighting, suffered 20 million dead and saw vast regions devastated by Hitler's armies, it has more to forget and less inclination to do so.

The commemoration of the 1945 victory also serves a political purpose for the Soviets, both internally and externally. The war, for all its horrors, was a unifying historical event, the point at which Russian patriotism became identified with the Soviet state. It also gave birth to the Eastern Bloc. In the Soviet view, both themes are worth repeating and magnifying for the benefit of its own citizens and its allies.

And finally, World War II stands in the Soviet mind as the bitter example of the price of military vulnerability. When Soviet officials repeat their admonition, "Never forget," they also mean never again to be put in a position of inferiority.

As the anniversary approaches, television, newspapers and cinemas have been literally clogged with wartime reminiscences. To the allies' dismay, the portrayal of their role is often belittling, sometimes negative.

And by putting stress on the military triumph -- of the Red Army in particular -- the Soviets have diverged from the conciliatory theme underlined in the West.

This has caused particular concern for the West Germans, who already have been the target of a year-long Soviet campaign accusing them of "revanchist" ambitions to reunite the two Germanys.

Although the revanchist theme has not been mixed into the victory celebrations, the scope and tone of the Soviet preparations for May 9 have disturbed Bonn.

Bonn's postwar allies are also sensitive to the West Germans' concern, and want to avoid getting involved in what one western diplomat called "a German-bashing session" in Moscow on May 9.

But there are dilemmas in this view, too, just as there were last year at the 40th anniversary of the Normandy landings. Then, the Germans were not invited. This year, President Reagan rearranged his schedule so as not to be in West Germany on May 8, the day V-E Day is celebrated in the West.

Given the nature of Hitler's war on Europe, no member of the former alliance wants to be perceived as passing over the suffering it caused.

"One of the tricky things that no one wants to ignore is that the defeat of fascism was something worth fighting for," said one western diplomat.

There is also the view that by participating in the Moscow celebrations, the former western allies would help lower the pitch of the propaganda and induce the Soviets to give more due to allied cooperation.

But, said one western diplomat recently, participation could lead to "embarrassment if, because of some of the things said, we had to walk out."

When they announced the upcoming 40th anniverary celebration last year, the Soviets said the theme would be first to remember Victory Day, and second to strengthen peace in the world. To some in the West, the second theme has been broadened to include the struggle against American imperialism and "militarization of space."

Unofficial groups of American veterans and citizens are expected to come for the celebrations, regardless of what happens on the official level. And if official delegations are invited and do come, these are likely to be on a low level, headed by people who themselves participated in the allied effort.

Some Soviets who took umbrage last year at the passing notice paid to the Soviet war effort during the celebration of D-Day, feel that the former allies do not want to acknowledge the Soviet half of the 1945 victory.

To them, a U.S. decision not to have official representation at Torgau on the Elbe River, where the U.S. and Soviet armies met on April 25, 1945, is a sign that memories of allied cooperation are hostage to the current political situation. The U.S. decision was taken in retaliation for the recent killing of a U.S. major at a Soviet military installation in East Germany.

"For us, the meeting on the Elbe means much more than for many Americans . . . . The objective truth is that they didn't go through the war the way we did . . . . People there seem to forget the main burden was carried by the Soviets, while we never forget the aid by the United States," said Foreign Ministry spokesman Vladimir Lomeiko during an interview in February.

The allies' delays in opening a second front against Hitler's armies in the West are still bitterly remembered here. And yet, said Lomeiko, "in spite of the fact that our hopes were betrayed many times and many of our relatives were killed, our people never held a grudge against the Americans. They always wanted good relations."

There have been occasional signs that the Soviets are eager for a joint celebration, honoring the wartime alliance as a symbol of potential for the resumption of good relations.

In a speech delivered in his name Feb. 22, two weeks before his death, the late Soviet leader Konstantin Chernenko made an appeal to the United States to use "the 40th anniversary of the end of the most terrible and most destructive of all wars . . . to jointly reaffirm, in a form suitable to both sides, the essence and spirit of the principal commitments that both countries made at the end of the war and in the agreements of the 1970s."

So far, no agreement seems to have been reached on such a joint reaffirmation. Because of the killing of U.S. Army Maj. Arthur D. Nicholson, it won't be on the Elbe and there is no sign yet that it will be in Moscow.

"We are like two beasts circling each other on this, not sure whether to shake hands or bite," noted one western diplomat.