Americans had begun to think that the Japanese and German economies were under a magic spell. Growth was fast, inflation was low, and exports were fiercely competitive. But now the chancellor of Germany has fallen and the premier of Japan is being pushed out of office, both the victims of corrosive quarrels over poor economic performance. For Americans, both cases illuminate alternatives to the Reagan strategy.

The Japanese economy has been essentially flat for several years, except for its exports. Now, with the slump in its foreign markets, even its exports are declining. But unlike every other major economy in the world, Japan has both inflation and unemployment under absolute control.

The explanation has more to do with Japanese cultural traditions than with technical economics. A passion for consensus makes it possible for the Japanese to end a surge of inflation simply by deciding, collectively, not to raise wages and prices. Try that in Detroit.

But the same consensus, over the years, has led to a deliberate suppression of standards of living in behalf of Japan's long-term goals of growth. That points to the solution of Japan's present loss of momentum: increased public investment in the infrastructure that a wealthy, highly urban society needs.

The Japanese budget deficit is already high but, with a rate of personal savings three or four times as high as in this country, Japan can afford to let it go even higher. With its remarkable social control over inflation, Japan is the one major industrial country that can now risk a classic Keynesian response to recession.

The outgoing premier, Zenko Suzuki, had been trying to balance the budget by imposing cuts in spending. It wasn't working. Whether to shift to a more forceful policy, and step up public borrowing and investment, is the central policy issue that underlies the factional quarrels within the dominant Liberal Democratic Party as it chooses a successor to Suzuki.

West Germany is in a much more difficult position. Inflation, at 5-plus percent, is disquietingly high by German standards. Like the United States, Germany enacted a series of generous social benefits and protections in the years of high growth in the 1960s and early 1970s. More high growth was supposed to pay for them. In Germany as in this country, a succession of low-growth years has brought large budget deficits. Meanwhile, unemployment is climbing fast.

Helmut Kohl, the conservative chancellor who took office this month, has one important advantage over Ronald Reagan. He can see how the Reagan experiment is turning out and he knows, at least, what not to do. He can see that a big tax cut, combined with a serious attempt to hold down inflation, means hair-raising interest rates and a currency that rises on the international exchanges. High interest discourages domestic investment, and high exchange rates discourage exports. To the Germans, that's not a very appealing prospect.

The Kohl government last week brought out a very different policy. The passages justifying the cuts in social benefits sound as though they had been written by David Stockman. But at the same time the Germans are now moving to increase public investment -- and they are imposing tax increases to pay for it. The German conservatives, unlike the Reagan administration, are careful about their relations with labor -- whose cooperation they need on inflation. The Germans' program means, among other things, jobs. In contrast the Reagan administration has been oddly inattentive to blue-collar concerns, despite the blue-collar vote for Reagan in 1980. Most American unions are vehemently protectionist, and as unemployment rises here, Reagan is repeatedly put in the position of either caving in to the crusades against imports, at great cost to the whole national economy, or rebuffing working people who supported him. That's a bad choice to have to make.

Kohl, instead, is going to try to give the unions tangible reasons to cooperate with him. Again, national tradition has a lot to do with it. The German unions were organized after World War II under conservative governments, and there's a long record of cooperation. But even allowing for a lot of history, it makes an American wonder whether relations between a Republican administration and the unions have to be as sourly adversary as they are.

Germany, Japan and the United States are all now governed by conservatives. In this country, the conservatives have been interested primarily in tax cuts and individual incentives. In both Germany and Japan, the conservatives seem to be much more concerned with mutual obligations, and the social webbing that holds people of different classes and conditions together around common national purposes. Over the next several years it will be interesting to see which of the three countries is best served by its conservatives. It's a test of much more than narrowly economic policies.