France's Socialist-led coalition today staged a partial recovery in the second round of politically important municipal elections following heavy losses to the right-wing opposition last week.

Encouraged by warm spring-like sunshine and a week of intense political propaganda, voters turned out in record numbers--more than 80 percent--to save the left-wing alliance of Socialists and Communists from the prospect of a humiliating defeat. The overall result of the two-round election, the first nationwide test of public opinion since President Francois Mitterrand came to power in May 1981, is to confirm France as a country divided almost equally between left and right.

The most dramatic gains for the right came in Paris where the neo-Gaullist mayor, Jacques Chirac, and his supporters scored a "grand slam" by taking all of the city's 20 districts. There was a modest swing to the opposition in other towns too, but nothing like the spectacular rebuff for the government that some Socialist politicians had feared following last week's election losses.

Prominent government figures who had appeared in serious danger of losing their local power bases managed to mobilize their supporters on the second round and scrape home. In one of the most closely contested battles, Interior Minister Gaston Defferre won reelection for a sixth term in the southern port of Marseilles, where he had been challenged on the issues of crime and immigration.

The lesson drawn by most political commentators from the elections was that French voters have been content to deliver the government a rap over the knuckles for its handling of the economy rather than the unambiguous "vote of no confidence" that opposition politicians had appealed for. Preliminary results suggested that in the final tally of voting for today and last week, right-wing and center parties would pick up between 30 and 35 of the 221 large towns. The left-wing coalition gained 61 towns in the last muncipal elections in 1977. That vote was interpreted as a personal defeat for then-president Valery Giscard d'Estaing, who was voted out of office four years later.

Looking relieved as he was interviewed on television, Prime Minister Pierre Mauroy, who was reelected as mayor of Lille today, said that the right had failed in its scenario of wanting to secure the downfall of the government through early general elections. He said that the day had been saved thanks to a significantly higher turnout by left-wing voters, many of whom had stayed at home in the first round out of disappointment with the government's austerity program.

Lionel Jospin, the Socialist Party secretary who was beaten in his own district of Paris last week, said that despite today's recovery the government could not afford to ignore the "warning" delivered by the voters last week.

All nine government ministers who had faced difficult runoffs in today's balloting were victorious. The popular minister of agriculture, Edith Cresson, even managed to buck the antigovernment trend by winning the town of Chatellerault, which previously had been held by the opposition.

The election results appeared likely to strengthen Mitterrand's room for political maneuvering. The limited losses give him an excuse for reshuffling the government should he wish to do so, but he is no longer in the position of having to find scapegoats for electoral disaster.

However, Mitterrand faces the urgent task of reversing France's continuing economic slide, which is reflected by high unemployment, high inflation and a record trade deficit of $14 billion last year.

The franc lost ground sharply against other European currencies, notably the West German mark, during the past week, and many financial analysts believe that it could be heading for its third devaluation in less than a year.

The Communists fared worst in the election by losing proportionately more ground than their senior coalition partners, the Socialists. Interviewed on television, Georges Marchais, the Communist Party secretary, blamed some of the losses on the lack of cooperation between the two parties in some towns. It is unclear whether this grudge will create strains within the government.

In the opposition camp, the big winner was Chirac's neo-Gaullist Rally for the Republic party. With results still to come in from a handful of towns, it had doubled its number of mayors from 19 at the last municipal elections to 38. By contrast, the rival Union for French Democracy party under Giscard managed to win in only three new towns for a total of 33 towns.

This is likely to help Chirac in his efforts to become the candidate of the rightists at the next presidential elections, which are due in 1988. In the last elections, he placed third behind Mitterrand and Giscard.

Less ebullient than after the first round, Chirac described the balloting as "a warning" for the government. Calling for "a profound change in government policies," he said that the French had "understood that the policies carried out for the past two years are fraught with danger."