Communist parties, long a fixture in the politics of capitalist Europe, are everywhere in decline -- and nowhere more so than in Finland, a country in the shadow of the Soviet Union.

In fact, the Finnish Communist Party is dying, as communist parties are dying throughout Western Europe. Social Democrats, who long ago tempered their revolutionary goals with bourgeois pragmatism, have taken the edge off the grievances of the working class, and are in undisputed control of political power in Finland.

The president and the prime minister are Social Democrats. The communists, who once captured one vote out of four in national elections, received less than one out of eight in the last.

The retreat of the Communist Party in Finland echoes events all over Western Europe. In France, though they hold several cabinet seats, the communists' share of the vote in national elections has declined conspicuously in the past decade. In Italy, the party has been steadily losing ground for several years and in Spain it has all but disappeared as a political factor.

There are very few people left who believe, as so many Europeans once did, that communism has the answers for the ills of modern industrial society. What appeals to Finns is the combination of socialist economic reforms and democratic processes endorsed by the Social Democrats.

For the Social Democrats it has been a long journey since the left battled the right in the bitter civil war of 1918. The left was defeated in that war. But the Social Democrats -- unlike their communist allies in the civil war -- reconciled themselves to the results and worked to reform capitalism within the parliamentary structure.

The election last year of a Social Democratic president, Mauno Koivisto, 59, showed that Finns (including much of the old right) trusted the party to preserve Finland's prosperity and its free society.

Koivisto, a contemplative, self-effacing man, is often contrasted with his much-respected predecessor, Urho Kekkonen, a centrist who for 25 years shaped the office and Finnish policies to his own autocratic temperament. In fact, the new president, long known for his moderation and common sense, has reassured Finns by affirming most of his predecessor's basic policies.

Foremost among these are adherence to Finnish neutrality and good relations with the Soviet Union -- the basis of Finnish diplomacy, and of Finland's independence, since World War II. These policies have grown out of a political consensus for avoiding further rounds in the long history of Russo-Finnish wars.

Moscow repays Finland for its position of neutrality on East-West issues by staying fastidiously out of Finland's domestic affairs.

Western detractors call this arrangement "Finlandization," a term that Finns resent. The arrangement, they say, has left them with the most peaceful frontier on the Soviet periphery and a political-economic system which has not compromised its own freedom.

The rise of Mauno Koivisto epitomizes the problems faced by the country's communists. In his youth he was a dockworker in Turku on Finland's west coast, where he is remembered as a foe of communist organizers. He enrolled in night school and, in his mid 30s, received his doctorate in economics. Since then he has been governor of the Bank of Finland, minister of finance, twice prime minister and finally president.

A man of Lincolnesque appearance, with knobby, working man's hands, Koivisto is a reminder of the upward mobility possible within the Finnish economic system. He is proof that the system makes a wide range of opportunities available to all social classes. This is perhaps the greatest problem faced by the communists.

The Social Democrats can take a large measure of the credit for the prosperity enjoyed by Finns. They were a major force in creating an equitable as well as a prosperous society. Now the system they have helped create has become so costly that the working class has as vested an interest in the economy's continued good health as the capitalists.

While the Social Democrats have been winning the allegiance of Finns in all social classes, the communists have been in retreat.

The constituency that Karl Marx said would always provide raw material -- the urban industrial labor force -- has been shrinking, as it has elsewhere. Industrial workers comprise only a third of the labor force and farm workers less than a tenth.

These problems are only aggravated by the proximity of the Soviet Union, a few hours away by train. Enough Finns have crossed the border to know that the heirs of the revolution of 1917, which came close to succeeding in their own country, have not produced a satisfactory alternative to what they have at home.

As if capitalist success was not enough, the shock of the Soviet invasion of Czechoslovakia in 1968 devastated the Finnish Communist Party. The Polish Communist Party's suppression of a genuine working-class uprising was a further blow.

Finnish communists were as outraged by the Soviet behavior as non- communists were. "Poland represents a struggle for the rights of workers in a socialist society," said Kalevi Kivisto, the mild-mannered moderate who led the Finnish communists in the last election. "This is a gut socialist issue."

But Soviet policy continues to damage the cause of Finnish communism. The recent crises severely shook the communist leadership within Finland's trade unions, once the bedrock of the party's support.

These defeats have only increased the strains within Finland's communist movement. Historically, the "moderates" have been the stronger wing, dominating and increasingly alienating a "Stalinist" minority.

In 1966, the communists voted for the first time to join a coalition led by Social Democrats to govern the country. Three years later they formally adopted a program of reforms which made them the first "Eurocommunist" party. The "Stalinists" insisted these reforms would only help the Social Democrats. In retrospect they were probably right.

Last December, with the complicity of the Social Democratic leadership, the Stalinists won a tactical victory, forcing the communists in the cabinet to resign from the government. The Stalinists argued that the party would do better in the impending parliamentary election by running on a strong oppostion platform. But in the election last March, the party took its worst beating ever.

Now, by their own admission, the communists are in disorder. A showdown is expected to come at next spring's party congress.

The Stalinists, if forced to go it alone, will no doubt present a hard- line slate at the next election. They will be ideologically pure, and probably win about 3 percent of the vote. For the moderates, the problem is even more complex. Philosophically, they are not far from the Social Democrats, and sooner or later the two groups may merge.

Finland, like Western Europe generally, seems to be proving that history is not moving in the direction that Karl Marx predicted. Workers have indeed cast off their chains, but having done that they have not chosen the communist road.