Portugal, poised for a leap forward into the European Community in January, appears to have stumbled again into a damaging period of political instability after a government crisis that has forced President Antonio Ramalho Eanes to call an early election.

Eanes, nearing the end of 10 turbulent years in office, announced Thursday night that he would dissolve parliament and call a legislative election two years early in an attempt to resolve the breakup of the ruling coalition of Socialists and Social Democrats. The vote is expected in October.

Parliament will not be dissolved until it has ratified the treaty for Portugal's admission to the European Community in January, Eanes said. Debate on the treaty is scheduled July 10. The present government will remain in office in a caretaker capacity until it is replaced. But the future of Prime Minister Mario Soares, who has asked to resign, is in doubt. He could be replaced by an independent.

Following the collapse of the 15th and longest surviving government since the 1974 armed forces coup returned the country to democracy, Portugal now faces the dilemma of finding a successful formula for stable government.

The fall of Soares' center-left coalition, the first democratic government to command a parliamentary majority, means every possible alliance of the three main noncommunist parties has been tried and failed.

Social Democratic leader Anibal Cavaco Silva, a hard-liner who took over the divided party in May, provoked the crisis two weeks ago when he pulled his seven ministers out of the 16-member Cabinet. He charged that the Socialists were delaying liberal economic reforms in a strategy designed to benefit the expected candidacy of Soares in a presidential election scheduled for January.

The president and the prime minister both strove to win backing from the parties for a compromise government in an effort to avert the disruption of an early legislative election. Formerly bitter political rivals, Eanes and Soares, the Socialist leader, now appear to share a fear that dissolving parliament only a few months before the presidential election will throw the country into a long, divisive campaign and jeopardize economic recovery.

But Eanes, grappling with the ninth government crisis in a decade as president, was left with no alternative to calling an election after three major parties, the Social Democrats, the Social Democratic Center Party (Christian democratic) and pro-Soviet Communists, rebuffed his plea to guarantee parliamentary support for a consensus government.

In a letter of resignation to the president, Soares said an early election carried two major threats, according to published reports. He warned that it would have "enormous economic and social costs . . . at a time when the country most needs a decision-making power to prepare our entry" to the European Community.

Soares added that "there is a very strong probability that an election will not substantially alter the relative strengths of the parties in parliament. This would place us in the same situation we are in now." This view is supported by a wide range of commentators and opinion polls.

The Socialists currently control 101 seats in the 250-seat parliament, the Social Democrats 75. The Communists are the leading opposition party with 44 seats, followed by the Social Democratic Center with 30. The Social Democrats' strategy is to revive their conservative alliance with the center party that governed from 1979 until Soares came to power in June 1983.

But such an alliance could not hope to command a workable majority over the combined opposition of Socialists and Communists. At the same time, a government built on a Socialist-Communist majority is not an option for Soares, whose political career is built on his defense of Portuguese democracy against Communist control.

Hoping to win a pivotal role in a reshuffle of alliances is the newly created Democratic Renewal Party, which held its first national convention last month. The vaguely left-of-center movement is built around the prestige and popularity of the president and is commonly known as the "Eanista" party.

The party could gather considerable momentum if Eanes takes over its leadership as expected when he steps down from the presidency. He cannot run for a third presidential term, and the party therefore must fight the coming election without the key vote-pulling advantages of an incumbent president. Polls indicate that the new party cannot hope to win more than 8 percent of the vote.

Eanes expressed frustration over the instability of Portugal's democracy in a rare interview published here Friday. He said his greatest disillusion since taking office was "the repeated failure of our efforts to build the modern country to which we aspire." But he added that his greatest joy was "the maturity of Portuguese people shown in their persistent particiption in elections despite the reasons that may have persuaded them to behave differently."