When the McDonald's hamburger chain was pilloried recently in one of West Germany's major newsweeklies for what was tagged "Wild West" working conditions, the owner of the McDonald's franchise in Bonn viewed the attack as a sign of the times. "Anti-Americanism," he grumbled to friends.

When Peter Bender, a West German historian and broadcaster, published a book this spring on "the end of the ideological era," he urged Europeans to defend themselves "culturally" against America. "Civilizing demagogy," he called the threat.

When Willi Piecyk, president of the youth wing of the ruling Social Democratic Party, wanted to arouse a congress of his peers last week, he knew what image to invoke. "Social democratic peace policies," he declared, "cannot be allowed to be cut to the size of an American cowboy hat."

At a time when the United States is experiencing a resurgence of self-confidence and pride, one of its most important European allies is evidencing a surge of strong feelings against U.S. foreign policies and behavior -- what West German Chancellor Helmut Schmidt describes as an "abominable vogue."

The sources for this are complex and stretch from Germany's past to America's new political present. But they have merged and found a powerful echo in the current peace campaigns and youth movements that have unsettled West German politics and rattled the Atlantic Alliance.

John J. McCloy, the former allied high commissioner in postwar Germany and a veteran observer of U.S-German relations, told an Aspen Institute conference in West Berlin last week, "I've never been as concerned as I am now about the alliance." The subject of the Aspen conference, which drew U.S. and European legislators, diplomats, Bonn government officials, former Carter administration members, educators and journalists, was anti-Americanism.

What complicates analysis of the trend is that no much sign of anti-Americanism as such shows up in West German public opinion surveys. The term itself may be misleading in describing the set of feelings that are meant.

Few West Germans, if asked, will say they oppose the United States. Just the opposite is true: a majority views America as West Germany's best friend.

Nor are there many anti-American street demonstrations of the sort that marked the Vietnam War protests of the 1960s or the "Ami go home" drives of the 1950s. In fact, for all the local community problems created by the continued presence of 300,000 U.S. troops in West Germany, few moves would so alarm West Germans as a U.S. withdrawal.

This fact underscores the ambiguity of the present West German attitude toward the United States. It is a mix of dependence and self-assertion, of admiration and resentment, of hope and disillusionment.

In approach to policy, this translates into a desire among many West Germans -- and this the surveys do reflect -- to keep a certain distance from Washington. The chief concern here is to stay out of conflict with the Soviet Union, preserve West Germany's substantial gains from detente, and maintain calm in Europe.

The critical feeling here toward the United States is partly a carry-over from last year, when the Soviet invasion of Afghanistan arrested the dialogue between the superpowers.

The Carter administration was seen as overreacting to the invasion by pressing for harsh sanctions. There were also anxieties about then-president Jimmy Carter's handling of the hostage-taking in Iran and, generally, about his political competence. The election of Ronald Reagan reinforced West German worries about an American contribution to a new cold war.

Reagan's anti-Soviet views, his administration's delay in beginning arms limitation talks and the tendency to see relations with the Third World in East-West terms all rub against West German preferences. One Schmidt adviser said recently that what is often referred to as anti-Americanism might more properly be described currently as anti-Reaganism.

Dieter Schroeder, foreign editor of the daily Sueddeutsche Zeitung, wrote last month that anti-Americanism is nearly as old as the United States. Schroeder recalled the haughty if also respectful regard classical poet Johann Wolfgang von Goethe had for America as a young nation and the aversion to America's materialistic values and unsophisticated manner that such German romantics as the poet Heinrich Heine expressed.

This cultural negativism toward America survives today in West German intellectual circles, which sometimes view American tastes as a sort of infectious perversion and look upon American society as a deteriorating, violence-prone, drug-addicted, over-competitive and morally bankrupt body.

Such attitudes never have posed a serious threat to Western alliance relations. Where the danger now comes is in the German public's doubts about and growing open resistance to Reagan's foreign policies.

The basis for this unrest is fear -- fear of what the new medium-range nuclear missiles planned for Europe will mean for the chances of an eventual nuclear war being limited to Europe; fear of a costly new arms race; fear of an eventual loss of stability and control in East-West relations.

"America, disdained for its 'superficial civilization,' is now also losing its image as protector of freedom," Schroeder wrote. "It is now being seen as a disturbing factor, as a troublemaker, as an 'imperialistic power.'"

Even the old Atlanticists in West Germany have difficulty coming to America's defense. The Vietnam War, the decline of the dollar, the perceived mismanagement of the Carter years all make it hard for some staunch pro-Americans here to summon their former enthusiasm.

For Americans who recall the postwar CARE packages and Marshall Plan aid to Germany, it is particularly annoying to hear of anti-Americanism. It is also upsetting to see the United States painted as the bad guy when, for instance, Washington sends a few dozen military advisers to El Salvador, while Moscow sends 80,000 troops to Afghanistan without drawing similar protests by youths.

As one young West German at the Aspen conference explained, this may be because the United States is held to a higher standard of behavior than the Soviet Union is.

West Germany is increasingly populated today by young people who do not feel the burdens of the past and who did not establish the NATO alliance, but inherited it. Many of them are hardly politically minded but reject America for what they regard it as symbolizing: consumerism, materialism, things nuclear and things modern.

Theo Sommer, editor-in-chief of the weekly Die Zeit and a close observer of the American scene, labeled this trend "anti-Americanism by inference, not by intent."