France's right-wing opposition parties won a slim victory in parliamentary elections tonight, effectively ending five years of left-wing government but leaving considerable room for maneuver to Socialist President Francois Mitterrand.

The election result paved the way for an unprecedented division of power between the Socialist president, whose seven-year mandate does not expire until 1988, and his right-wing political opponents. It marks the first time in the history of the Fifth Republic that a president has lost control over the National Assembly, the main house of the French Parliament.

With all but two seats from overseas territories decided, the conservative neo-Gaullist Rally for the Republic (RPR) and the center-right Union for French Democracy (UDF) won 291 seats in the 577-member assembly, just two more than the 289 minimum required for an absolute majority in the assembly. But the Socialists remained easily the largest single political party, with 216 seats, after collecting more than 30 percent of the vote, according to the Ministry of Interior.

The extreme right-wing National Front entered the National Assembly for the first time, with a 34-seat delegation, thanks in part to the new system of proportional representation introduced last year by the Socialist government. The front, which has campaigned against immigration, pulled even with the Communist Party, which continued an apparently inexorable electoral decline and also collected 34 seats.

Despite their narrow majority in the new assembly, leaders of the RPR-UDF coalition indicated in statements tonight that they were ready to form a government and set about implementing a joint election program. Many right-wing leaders blamed the disappointing result, which fell well short of their expectations, on the new voting procedures.

"The French have made their choice," said neo-Gaullist leader Jacques Chirac in a postelection statement. "They have demonstrated their wish to see the formation of a new government. They have decided that this government should implement the policy proposed by the RPR and UDF."

With all of France's mainland votes counted, figures released by the Ministry of Interior gave the RPR-UDF coalition 45 percent of the vote, the Socialists 32 percent, the Communists and the National Front each just under 10 percent. This compares with 40 percent for the RPR-UDF in the first round of the parliamentary elections in 1981, 37.4 percent for the Socialists, 16.1 percent for the Communists and 0.4 percent for the extreme right.

The 1981 result was considered exceptional for the Socialists, since it followed Mitterrand's victory in the presidential elections. In the present election, the Socialists set themselves an optimistic target of 30 percent of the votes or 200 seats in the assembly.

The success of the National Front was described by outgoing Prime Minister Laurent Fabius, who is expected to hand in his government's resignation in the next few days, as "a cause of legitimate concern for all democrats." The front's president, Jean-Marie Le Pen, said that his party had achieved its main goal of "defeating the Communist Party."

Political analysts said Mitterrand appeared to have succeeded in his aim of dividing the right-wing opposition while maintaining a solid base of Socialist Party support in the assembly.

The Fifth Republic constitution, introduced by Gen. Charles de Gaulle in 1958, gives the president the right to name a prime minister but also allows the National Assembly to reject the choice. He is also empowered to call a referendum.

Mitterrand refused to say whom he would name prime minister or when he would make the announcement. But he acknowledged that the Socialists were no longer in a position to form a government after losing their majority.

"I'm not blind. Even if the Socialist Party has scored a certain success, it does not have allies, which would permit it to have a clear majority," the president told journalists in his home town of Chateau-Chinon in central France, where he registered his vote.

Spokesmen for the RPR and UDF parties, which campaigned on a joint electoral platform, called on the president tonight to appoint Chirac as the new prime minister. As president of the RPR, the largest of the two opposition parties, Chirac, 53, long has been mentioned as a leading candidate to head the government in the event of a right-wing victory.

Other possible candidates for the post include former neo-Gaullist prime minister Jacques Chaban-Delmas, 71, or two leading UDF politicians, former president Valery Giscard d'Estaing, 59, or Simone Veil, 58, who served as the first woman president of the European Parliament.

Some analysts speculated that Mitterrand might take advantage of slim right-wing victory to turn to a neutral political figure, even though he said earlier this month that he would name the new prime minister from the ranks of the "new majority."

The UDF group in the assembly includes a handful of deputies led by former prime minister Raymond Barre who oppose any compromise with Mitterrand. Tonight, however, Barre said that he would not do anything to prevent the formation of a new right-wing government.

In theory, the appointment of a new prime minister could be delayed until the new assembly meets on April 2. In practice, however, political commentators expect the president to move more swiftly, particularly in view of the foreign policy crisis in Lebanon, where eight French citizens have been kidnaped by pro-Iranian extremists.

Exit polls indicated that economic issues, particularly the high rate of unemployment -- which increased by 40 percent under the Socialists to a record of 2.3 million -- had played a dominant role in the campaign. Foreign policy issues, including criticism of the government for its handling of the hostage affair, seemed to have had little impact.

The Socialists appeared to benefit from a swing in their favor during the campaign as a result of a gradual upturn in key economic indicators. Figures published this week showed the first monthly drop in the French inflation rate since June 1966, as well as a small surplus in the trade balance and reduction in unemployment.

The RPR-UDF coalition has promised gradual denationalization of banks, insurance companies and large industrial groups that were taken over by the state after the left-wing election victory in May 1981. It has also pledged rapid legislation to reinstate the old system of majority voting in two separate rounds, used to elect successive National Assemblies under the Fifth Republic.

Much of the election campaign was taken up by the constitutional debate of whether it would be possible for Mitterrand to "cohabit" with a right-wing government for the remaining two years of his presidential term. Exit polls suggested that a clear majority of French voters were in favor of "cohabitation," even though there was considerable skepticism over whether it can work.

In dramatic contrast to previous elections, particularly May 1981, when several hundred thousand Socialist supporters celebrated Mitterrand's election at the Place de la Bastille, there were no victory celebrations in the streets of Paris. After a somewhat lower turnout than usual, about 77 percent, most voters remained at home to watch the results on television.

The slim victory for the right is not expected to lead to significant changes in French foreign policy, an area in which there has been consensus between government and opposition during the past five years. In the view of western diplomats here, conflicts could arise between the president and the government over who is responsible for carrying out the policy.

One of the few points of difference has involved President Reagan's Strategic Defense Initiative, which is viewed more favorably by the RPR-UDF coalition than by the Socialists, despite a shared concern that it could eventually undermine the effectiveness of France's independent nuclear deterrent. The new majority has said it will reverse Mitterrand's refusal to associate the French government with "Star Wars" research.

On domestic issues, the RPR-UDF coalition has said that it will continue with the policies of economic austerity introduced by the Socialists in 1983 after the failure of attempts to reflate the economy through deficit spending. The recent sharp decline in oil prices and the slump in the value of the dollar seems likely, however, to give a new government greater room for economic maneuver than had been expected previously.

The new deputies in the assembly include former defense minister Charles Hernu, who was forced to resign his post last September after being blamed for the sending of French secret agents to New Zealand to blow up a Greenpeace ship.

A Socialist Party list in the Rhone region headed by Hernu won five seats and the UDF list headed by Barre, a likely right-wing candidate in the next presidential elections, got three.

Hernu, who has repeatedly denied responsibility for the sabotage of the Greenpeace ship, had earlier said that he might consider running for the presidency if he did as well as Barre in the election. The former prime minister also won a seat in the assembly by a wide margin.