Socialist leader Andreas Papandreou, who opposes Greece's participation in NATO, appeared tonight to have made substantial gains in Greek national elections that cut sharply into Prime Minister Constantine Karamanlis' electoral mandate.

The conservative prime minister's share of the popular vote decline to roughly 42 per cent from nearly 55 per cent three years ago, according to preliminary estimates. Papandreou's popular strength was almost doubled and he was expected to become the new leader of the opposition.

With a fifth of the ballots counted, Karamanlis' New Democratic Party held between 41.5 and 42.5 per cent of the vote. Papandreou's Panhellenic Socialist Movement had 24.6 per cent of the ballots, followed by 13.2 per cent for incumbent opposition leader George Marvos and his Center Democratic Union.

The two extremes of the political spectrum, the Moscow-line Greek Communist Party and the ultra-rightist National Rally held 8.12 and 7.1 per cent of the vote respectively.

"The big surprise," said one political observes, "is the staggering percentage for Papandreou. The rightists also seemed to be doing better that expected. For the moment, the real losers appeared to be the center and the moderate left."

The new alliance of progressive and leftist forces, composed of Eurocommunists, Socialists and Christian Democrats, took only 2.15 per cent of the ballots, although two of its most respected leaders, Elias Eliou and Leonidas Kyrkos, seemed assured of parliamentary seats.

Although Karamanlis' New Democracy Party had hopes for 48 per cent of the vote, the premier can form a majority government with anything between 40 and 42 per cent of the ballots, depending on voting patterns and constituencies, under the country's highly complicated proportional vote system.

"I will not discuss percentages," Karamanlis said in an interview, "but I can assure you that my parliamentary majority will be comfortable."

According to New Democracy circles, comfortable translates into 170 of Parliament's 300 seats.

The considerable reduction in Karamanlis' 1974 mandate, which gave him 54.4 per cent of the vote, has had an impact on some of the leading figures in his conservative government, who face defeat tonight for the first time in post-war years.

Today's elections, which have long-range implications for the West, seemed destined to end Karamanlis' overwhelming power base in the one-chamber Parliament, where he will have to contend with the dynamic, anti-American Papandreou on all issues, including the major foreign policy questions of Cyprus, Turkey, NATO and relations with the Untied States.

Shifts in the traditionally conservative farming regions, and a wide-ranging program of social and economic reform were largely responsible for the 58-year-old Papandreou's electoral gains, according to experts.

It was also a reaffirmation that change or "Allagi," emblazoned on Papandreou banners throughout the country, was central to the electoral campaign.

Appearing at the press center, a jubiliant Papandreous said his party was the real winner of these elections . . . And tonight is a very important step in our becoming the next government of Greece."

Injecting issues and programs into an otherwise listless electoral battle, the charismatic Papandreous abandoned the radicalism of his last electoral effort and brought a new moderation to his party's campaign. But his cry for a "Greece for the Greeks" was unrelenting, as was his opposition to NATO and the close ties that have long existed between Washington and Athens.

Though he favors a special agreement with the Common Market, Papandreou also is against Greece's full entry into the EEC.

Karamanlis followed the results from his penthouse apartment. He was most interested in limiting his losses, according to ranking aides. And, though Karamanlis seemed assured of being able to form a majority government, new life has been injected into reports of a Karamanlis-Mavros coalition to give the conservative leader a broader power base.

Attributing tonight's results to a new polarization in Greek political life, the 67-year-old Mavros pledged to do anything he could "to fight this polarization."

Observers saw this as a clear challenge to Papandreou's bid to other opposition parties to form a united parliamentary front.

The threat of a confrontation with Turkey, which returned Karamanlis to power in 1974, did not in the view of political observers play a major role in the electorate's priorities today.

Some observers believed that the Prime Minister was hurt by the lack of a substantive program and by his own refusal to campaigh. He addressed only four rallies before the elections, and gave one television speech.

Obviously incensed over the charges hurled against him by his opponents, he told a Friday night rally in Athens Syntagma Square, "I refuse to imitate my opponents by indulging in demagogy. i would rather face a dignified defeat than a degrading victory."

He then directed his fire against Papandreou, warning that he was "dangerous" for Greece.