Five months before the event, the West German government is striving to contain what it views as potentially volatile political emotions surrounding the 40th anniversary of Nazi Germany's capitulation.

Chancellor Helmut Kohl, who is to serve as host for the western economic summit a few days before the May 8 anniversary, is seeking to enlist allied participants in a political declaration emphasizing the war's outcome as a triumph of free democracy over fascism and not the defeat of Germany.

At the same time, Bonn officials, while still expressing support for an early East-West summit, are discouraging suggestions that the anniversary could provide a pretext for a Berlin meeting between President Reagan and Soviet President Konstantin Chernenko.

There is still lingering pique in West Germany over being excluded from last June's allied commemoration of the D-Day invasion.

Bonn is trying to gain assurances from the United States, Britain and France that ceremonies next year will blur lines between victors and the vanquished, including Japan and Italy as well as West Germany.

The coordinated observance by the allies of May's date marking 40 years since the war ended was an important topic in Kohl's meeting with Reagan during the chancellor's recent one-day visit to Washington, Bonn officials said.

The reaffirmation of allied postwar reconciliation at a summit ostensibly devoted to economic issues was described by one senior official as "every bit as important" as the U.S. insistence on a declaration at the Williamsburg, Va., summit two years ago stressing the West's will to deploy new missiles if an arms- control deal could not be reached with the Soviet Union.

"We believe in looking more to the future and not the past," said Horst Teltschik, Kohl's chief foreign policy adviser. "Building on 35 years of German democracy is more important than dwelling on the defeat of Germany."

Michael Stuermer, a history professor at Erlangen University and a close consultant of the chancellor, said the allies "must be very careful" in how they deal with the persisting German sensitivities about sovereignty and occupation.

"We have every reason to be ambivalent about the May 8 anniversary," Stuermer said. "If it is not handled properly, it could result in an enormous upgrading of left-wing German nationalism.

"We can expect a lot of Greens and leftist youths to be asking if the U.S. troops liberated us, why are they here?" he said.

According to aides, Kohl wants to keep all official observances of the Nazi capitulation subdued. He plans to visit the former concentration camp of Bergen-Belsen to make a speech on April 21, the day before prisoners there were freed.

The White House and the Bonn Chancellery reportedly are assessing the possibility of a joint pilgrimage by U.S. and West German leaders to Dachau, should President Reagan stay in West Germany for a state visit after the economic summit.

Kohl and Secretary of State George P. Shultz are expected to discuss the notion of an official Reagan visit when they meet Saturday at Kohl's private home near Ludwigshafen.

The only planned official activity on May 8 marking the surrender of Nazi forces is a prayer service in Cologne's famed gothic cathedral for all casualties of war and victims of despotism.

The West German government is anxious about the diplomatic impact of the looming anniversary. The Soviet Union already is preparing for mammoth celebrations stressing the indomitability of the Russian homeland and inviolability of post-war frontiers.

In that regard, West Germany is anticipating a renewed barrage of Moscow-led propaganda attacks accusing Bonn of "revanchist" aims to regain former German territories now incorporated into East European countries.

West German officials are convinced that the Soviet Union, which pressured East German leader Erich Honecker and Bulgaria's Todor Zhivkov to cancel trips to West Germany in September, is determined to isolate Bonn from any improvement in the East-West climate in the months leading up to the May anniversary.

France has announced that Chernenko is expected to visit Paris in the spring, although no date has been set. Mikhail Gorbachev, the number two member in the Soviet Politburo, is scheduled to begin a visit to London this weekend.

The prospect of a superpower summit in Berlin to mark the Soviet-American wartime alliance has stirred speculation as a possible topic for discussion when Shultz meets Soviet Foreign Minister Andrei Gromyko in Geneva next month.

A high-ranking Soviet official, attending a recent seminar in West Berlin, indicated the idea of a summit could arise if the exploratory talks about arms control proceeded well.

West German officials admitted a Berlin meeting between Reagan and Chernenko might seem appealing to Moscow and Washington because of its symbolic nature as an encounter between former wartime allies.

This kind of setting might obviate earlier preconditions that prevented such a summit, that it be well prepared and capable of achieving concrete results.

But Chancellery and Foreign Ministry officials expressed skepticism that a Berlin meeting could take place, if only because the United States and the Soviet Union would have a hard time deciding in which part of Berlin they would meet.

Moreover, while the Soviet Union has been seeking to gain affirmation of its hegemony in Eastern Europe, as underscored at Yalta and Potsdam, the Reagan administration has tried to avoid any implicit recognition of lasting Soviet control in the region.

"There are too many booby traps in a Berlin summit," an East-West specialist in Bonn said. "Any meeting next year between Reagan and Chernenko should be removed from the touchy German problem."

He suggested other anniversaries in 1985 that could offer a forum for a summit: in Helsinki, 10 years after the signing of accords on Security and Cooperation in Europe; in Vienna, 30 years after the state treaty assuring its neutrality; in New York, 40 years after the creation of the United Nations.