Harsh economic realities are catching up with Greece's Prime Minister Andreas Papandreou, forcing his Socialist government to revise many of its more radical policies.

Both Greek analysts and foreign diplomats here say they believe that the growing economic crisis has restricted Papandreou's freedom of maneuver both at home and abroad, making it difficult for him to fulfill campaign promises to close down U.S. military bases or withdraw Greece from the North Atlantic Treaty Organization.

The past two months have witnessed a sudden surge in protests against the Papandreou government by disillusioned left-wing supporters. The trade union movement, which previously had been considered a natural ally for Greece's first Socialist leader in more than a generation, is split over new austerity measures introduced by the government in return for a $1.4 billion loan from the European Community.

On the political fringes, there also has been trouble at the Athens Polytechnic school following the shooting of a 15-year-old student demonstrator by police. Also, in a rare incident of terrorist violence, a policeman was killed in a bomb attack on a police bus by left-wing extremists.

The sudden turnaround in Papandreou's fortunes comes less than six months after he led his party to its second election victory in four years. In what was widely regarded as a brilliant piece of political theater, the prime minister succeeded in transforming the electoral battle into a left-right clash after forcing the resignation of Greece's conservative president, Constantine Karamanlis, last March.

By posing as the champion of radical change, Papandreou was able to reduce the vote of the pro-Moscow Communist Party and consolidate his dominance over his own Panhellenic Socialist Movement (Pasok). The right-wing opposition, still in disarray after its defeat in 1981, was unable to match Papandreou's appeal.

"It was a stroke of genius," marveled a western diplomat, recalling the skill with which the Harvard-educated prime minister rallied disillusioned party members with a surprise announcement opposing the president's reelection. "He went into a hostile room and came out half an hour later with a standing ovation."

The economic situation has failed to improve since the election. Inflation has risen from 17 to 21 percent, the public sector deficit is the largest of any country in Western Europe, and the country's foreign debts exceed $15 billion. By October, in the view of most economists, there was no alternative to austerity if the Greek government wanted to avoid going hat in hand to the International Monetary Fund.

"Papandreou had been living in economic cuckoo land and suddenly came up against the buffer of reality. For the first time, he is being forced to do things that displease his supporters," a western analyst here said.

The government's austerity package includes the abandonment of one of the measures that won Pasok the support of the industrial work force: automatic inflation-linked salary increases. As a result, real incomes are likely to drop, by about 6 percent next year, for the first time since the Socialists came to power.

The Socialist about-face on the economy resembles similar policy reversals by left-wing governments elsewhere in Europe, although it has taken longer. In France, the Socialists abandoned ambitious plans for economic growth in 1983, two years after they came to power. In Spain and Portugal, the conversion to economic pragmatism came even more swiftly.

Greek officials have defended the new austerity program as intended to reduce consumption and transfer resources to investment to build a new industrial base, an effort they say was neglected by their conservative predecessors. The austerity measures were recognized as needed even by opposition economists, one senior official said, "but if the opposition implemented them, we'd have 1 million people marching in the streets of Athens."

In theory, Papandreou could make some dramatic foreign policy gesture to divert the attention of his supporters from economic failure. In practice, most analysts here believe that he cannot afford to antagonize western bankers by straining Greece's ties with NATO.

"In 1981, Greeks voted for major change. Today they want a better life. The only spectacular gestures that matter now are those that help the economy. Papandreou will survive or collapse on the basis of his economic record," predicted Panayote E. Dimitras, the director of an Athens polling firm, Eurodim.

In the past, Papandreou has resorted to anti-American rhetoric to keep his left wing quiet and quell rumors that his government is drifting to the right. He has caused anger in Washington by accusing the United States of "expansion and domination" and by refusing to join other NATO countries in condemning the imposition of martial law in Poland and the Soviet downing of a South Korean passenger plane.

His anti-Americanism has proved generally popular among Greeks who resent U.S. support for the military junta that ruled the country from 1967 to 1974. But attitudes are likely to change once people become aware of the economic costs involved in breaking with NATO or closing the U.S. bases.

"Nobody has explained to the voters that, if we close down the bases, we also lose $500 million a year in U.S. military aid," Dimitras said.

A recent remark by Papandreou has been interpreted by western diplomats here as a sign that he probably will negotiate a new bases agreement after the present one expires in 1988. Addressing the Pasok Central Committee in September, he chided some party members for confusing the party's long-term strategy on such issues as closing the U.S. bases and leaving the European Community and NATO with its "intermediate aims" and "tactical maneuvers."

"It would be too risky for Papandreou to run against the West now," a western diplomat commented, noting that the second half of the EC loan is dependent on Greece's economic performance over the next year.

Although the austerity measures adopted in October go further than ever before, western economists are skeptical that they will be sufficient to cure Greece's economic ills. This raises the prospect of even more radical measures in a couple of years if ambitious economic targets set by the EC are not met.

Some commentators predict that Papandreou could face a serious crisis next spring once workers start to feel the effect of the austerity measures. While the right-wing opposition remains politically weak, Papandreou's authoritarian manner has created considerable resentment in his own party.

A less alarmist prediction is that workers will be too preoccupied with keeping their jobs to stage major strikes. In this analysis, Papandreou could succeed in muddling through until 1987 or 1988 before playing his remaining trump cards of renegotiating the bases agreement with the United States and calling early elections again.

The Army and police, potential sources of a right-wing backlash in the past, have been neutralized politically, in the opinion of most analysts. The memory of seven years' military dictatorship and the loss by ethnic Greeks of half of nearby Cyprus to Turkish control in 1974 are fresh enough to rule out another coup unless there is a spectacular collapse of democratic institutions.