Meeting in the shadow of almost certain defeat in legislative elections next March, this weekend's Socialist Party congress has provided two leading left-wing politicians with a launching pad for their long-term presidential ambitions.

With less than five months to go before France chooses a new National Assembly, the congress has been dominated by ringing calls for party unity in the face of the threat from the right-wing opposition. But the major, if unspoken, theme has been the beginning of what promises to be a bitter struggle to choose the Socialist Party's candidate to succeed Francois Mitterrand as president of France.

In one corner is Prime Minister Laurent Fabius, 39, a cool-headed technocrat widely believed to be the president's choice. In the other is former agriculture minister Michel Rocard, 55, an intense intellectual who heads the party's more conservative faction and whom the opinion polls consistently rank as the most popular politician in France.

The emergence of Fabius and Rocard as the leading contenders for Mitterrand's mantle reflects the political transformation of the French Socialist Party during its four years in power. Although they are personal rivals, both men have worked in different ways to modernize the party's electoral appeal by jettisoning ideological notions of class warfare.

The present congress has witnessed the eclipse of old-time Socialists such as former prime minister Pierre Mauroy who implemented a series of radical reforms, including the nationalization of the banks and major industries, after the leftist election victory of May 1981.

In his keynote speech today, Fabius urged the 2,000 delegates to abandon what he described as "the culture of opposition" and recognize that, after four years in power, they had become the natural party of government.

Arguing in favor of a "socialism of the possible," he added: "We still speak sometimes of a socialist experiment as if it were something that should be conducted inside a laboratory."

Addressing the congress on Friday, the opening day, Rocard criticized the expansionist economic policies pursued by the Socialist government after the 1981 election victory. He was whistled at and booed by some delegates when he said the increase in France's foreign debt incurred during the first two years of left-wing rule had complicated the task of tackling unemployment.

The question of whether to acknowledge past mistakes is one of the key issues dividing the two wings of the party headed respectively by Rocard and Mitterrand. The Socialists were forced to abandon their ambitious plans for economic growth in March 1983 following two devaluations of the French franc, a dramatic widening in the foreign trade deficit and an increase in foreign indebtedness.

Economic austerity and an impression of political amateurishness fed by the recent scandal over the sinking of a Greenpeace ship by the secret services have, in the opinion of most analysts here, deprived the Socialists of any chance of forming a government after the 1986 elections.

The same polls show, however, that the presidential elections, due in 1988, are still wide open. Both Rocard and Fabius are given a good chance against most of the leading opposition candidates.

Held in a hangar-like exhibition hall on the outskirts of Toulouse, this weekend's congress illustrated both the strengths and weaknesses of the two Socialist rivals for the presidency. Rocard, whose standing in the country at large has traditionally been much higher than it is in the party, surprised friends and opponents alike by doing much better than expected in the preliminary voting for delegates. His supporters won nearly 30 percent of votes cast by party members, up from 21 percent in 1979 when he ran against Mitterrand.

Rocard has, however, been dogged with the reputation of being a "brilliant loser" unable to cash in on his early promise. An effective television performer, Rocard is strangely lackluster and uninspiring when he tries to deliver major speeches. His performance at the party congress was widely considered to be a disaster by French journalists, who had trouble deciphering what he was trying to say even when they could understand his rapid-fire delivery.

While Rocard has established a reputation for "speaking the truth," Fabius has based his appeal on "speaking clearly." His rhetorical style is the opposite of that of his rival: clipped, controlled and crystal clear.

The prime minister's dispassionate manner has cost him support among Socialist Party activists who tend to regard him as a political cynic without true leftist credentials. He skillfully attempted to overcome this handicap today by weaving sure-fire applause lines into his speech on such subjects as solidarity with South African blacks and a call for a tax on international arms sales.

Unlike Rocard, who led a small leftist party before joining the Socialists in 1974, Fabius has no identifiable political constituency of his own. Instead, his strategy is to project himself as Mitterrand's designated successor and political heir.

Fabius' high standing in the opinion polls has slipped somewhat in recent months, in part because of his handling of the Greenpeace scandal. The ruthlessness with which he pinned political responsibility for the sinking of the environmental ship, and the subsequent cover-up, on former defense minister Charles Hernu has upset some Socialist activists.