France's moderate right-wing opposition parties narrowly secured an overall majority of votes tonight in local elections widely regarded as a dress rehearsal for crucial legislative elections early next year.

If repeated in 1986, today's vote means that the traditional right-wing parties would control the National Assembly without having to rely on the support of the extreme right-wing National Front. That, in turn, raises the possibility of a confrontation pitting a national legislature dominated by the right against a Socialist president, Francois Mitterrand, whose term of office does not expire until 1988.

The local election results are likely to be scrutinized closely by all the major political parties as they start to shape their campaign for the National Assembly elections. Today's voting was conducted in half of France's 95 metropolitan and four overseas departments.

According to preliminary computer predictions, right-wing parties, including the National Front, gained 58.4 percent of the vote, against 41.1 percent for the combined left, including the Communists and the Socialists. This represents a total reversal of the balance of political forces since the left-wing election victory in 1981.

The popularity of the Socialist government has slumped during the past three years since it was forced to abandon ambitious plans to expand the economy in favor of stringent austerity measures. Unemployment has risen to an all-time high of 2.5 million, and living standards have declined, even though the Socialists have claimed some success in bringing down inflation and narrowing the trade deficit.

While acknowledging that tonight's results represented a further setback, Socialist spokesmen pointed out that the party had done better than in last June's elections for the European parliament. They also took comfort from political divisions on the right.

Computer projections showed that the electoral alliance of the Union for French Democracy (UDF), led by former president Valery Giscard d'Estaing, and the neo-Gaullist Rally for the Republic (RPR) won 33.5 percent of the vote. Another 16.5 percent went to other moderate right-wing parties, with the National Front gaining 8.4 percent.

On the left, the Socialists won 25.8 percent -- with 12.9 percent going to the Communists, who quit the government last year to protest rising unemployment.

Socialist Party leaders acknowledge privately that they have no chance of repeating their 1981 achievement of winning an outright majority in next year's elections for the National Assembly. Their strategy has been to encourage divisions within the opposition in the hope that moderate center-right politicians will join a new government supporting Mitterrand rather than allying with the National Front.

Predicting the result of next year's elections is further complicated by Mitterrand's announced intention of introducing a measure of proportional representation in place of the present system of majority voting.

The Communist Party announced tonight that it would call on its electors to vote for "the best-placed leftist candidates" in a second runoff round of voting next Sunday. Under the present electoral system, candidates must win 50 percent of the vote to be elected.

The Communists' decision was welcomed by the Socialist Party, many of whose candidates need Communist support to be assured of election on the second round.

The attitude of the moderate right-wing parties toward similar electoral alliances with the National Front is much more ambiguous. Party leaders have said that they will not reach any agreement with the front on the national level, but have not excluded local ad hoc arrangements.