Socialist President Francois Mitterrand said tonight he will appoint one of his right-wing political opponents to head a new government "tomorrow" following a narrow opposition victory in France's parliamentary elections.

In a television broadcast, Mitterrand said he was prepared to let a new right-wing government implement an electoral platform that differs in many respects from that of the outgoing left-wing administration. But he also served notice that he intends to retain an important role for himself, particularly in foreign policy.

In the aftermath of the election, Mitterrand was seen here as having succeeded in transforming an electoral defeat into what amounted to a political victory by shrewd tactics that served to prevent the formation of a solid majority opposing him in the new National Assembly.

The outgoing Socialist prime minister, Laurent Fabius, today had a 90-minute meeting with Mitterrand and tendered his resignation. It will not become effective until the nomination of a new prime minister.

The appointment of a new right-wing prime minister will mark the first time in the 28-year history of France's Fifth Republic that the key executive post has not been filled by someone politically loyal to the president. In the past, presidents from Charles de Gaulle onward have been able to impose their will on both the government and the National Assembly.

Mitterrand, 69, did not say in tonight's three-minute broadcast whom he intended to name as prime minister, and it was not clear whether he literally meant to do so "tomorrow" or referred merely to the near future. Presidential aides refused to clarify his intentions.

The constitution gives the president the power to appoint anyone he chooses, while allowing the National Assembly -- the main house of Parliament -- to reject his candidate if it regards him as unsuitable.

Right-wing spokesmen today urged Mitterrand to appoint neo-Gaullist leader Jacques Chirac, 53, on the ground that he heads the largest political party within the new majority. They also indicated that they might reject such right-wing nominees as former prime minister Jacques Chaban-Delmas, 71, or Simone Veil, 58, the former president of the European Parliament.

French commentators said that if Mitterrand chooses anyone other than Chirac, the cohesiveness of the right's thin majority in the new assembly will immediately be put to the test.

With two results from France's overseas territories still to be declared, the mainstream right-wing parties have an overall majority of only two seats in the 577-seat chamber.

The new majority consists of 150 deputies for the conservative Rally for the Republic (RPR), headed by Chirac; 127 deputies for the center-right Union for French Democracy, headed by former president Valery Giscard d'Estaing' and 14 independent right-wing deputies. The independents are predominantly dissident RPR or UDF politicians who decided to run on their own after losing local power struggles within their parties.

The RPR-UDF coalition also includes a handful of deputies loyal to former prime minister Raymond Barre, who has indicated that he is opposed in principle to any compromise with Mitterrand. Barre is widely regarded as a leading presidential contender.

The chances of survival for a new government are somewhat greater in practice than they would appear in view of the divisions on the right. According to the constitution, an absolute majority -- that is, 289 votes -- and not simply a plurality is required to topple the government on a vote of censure. As long as the independent deputies or Barre supporters do not vote against the government, its survival seems assured, and Barre last night promised to do nothing to bring down a new right-wing government.

Besides implementing its program, the new government willface a foreign policy crisis in Lebanon, where Shiite Moslem militants are holding seven French captives.

In a new terrorist act today, a bomb exploded on a high-speed train near Paris, injuring 10 persons. No group immediately took responsibility. A previous series of bomb attacks in December and January was widely attributed to pro-Iranian groups seeking the release of Arab prisoners in French jails.

On television tonight, Mitterrand noted the "weak" nature of the new majority and congratulated the outgoing Socialist administration on "leaving France in a good state."

The principal economic indicators have improved sharply during the past few months following imposition of strict austerity measures in 1983.

Mitterrand wished the future government success "in the action that it is now in a position to undertake, according to its views." He said that the only way to resolve political conflicts between the different branches of the executive was "the scrupulous respect of our institutions."

Indicating that he intended to continue to play a prominent role, he added: "As for me, I will devote myself to defending both at home and abroad our liberties and our independence, our commitment to Europe, and our place in the world."

The constitution is unclear about the precise division of powers between the president and the Cabinet. Much of the uncertainty over the prospect of what the French have termed "cohabitation" between left and right has been due to the fact that this is the first time the constitution, which worked well for an all-powerful president, will be tested under different conditions.

In a joint campaign platform, the RPR-UDF coalition promised to denationalize banks and leading industrial groups taken over by the Socialists in 1981 and relax state controls over the economy.

The right is also committed to the immediate repeal of the new electoral system of proportional representation in favor of the old system of majority voting in two separate rounds.