The French government admitted today that secret service agents acting under orders sabotaged an antinuclear protest ship belonging to the environmentalist group Greenpeace in New Zealand's territorial waters.

The dramatic statement, read in grave tones on live television by Prime Minister Laurent Fabius, marks a complete reversal of the official version of the Socialist government for the past two months. Until now, France has denied repeated allegations that its agents sank the Greenpeace ship, the Rainbow Warrior, in the New Zealand port of Auckland on July 10.

Although the prime minister's statement contained the first official acknowledgment of French responsibility for the sinking of the Rainbow Warrior, it carefully avoided the crucial question of who ordered the operation.

The government's about-face comes as a serious embarrassment to President Francois Mitterrand just six months before crucial elections for a new legislative assembly. The ruling Socialists, already trailing behind the right-wing opposition in the opinion polls, now have been tarred with a major political scandal.

"Agents of the DGSE [French secret services] sank this boat. They acted on orders," Fabius said at a hastily summoned press conference in his office.

"The truth about this affair is cruel. But it is essential that it be clearly and thoroughly established," he said.

[In Wellington, New Zealand, Prime Minister David Lange told reporters Monday that New Zealand's position in the affair had been vindicated by the French admission, Reuter reported. But he criticized the French government's refusal to name the agents involved and called the July 10 bomb attack "a sordid act of international, state-backed terrorism."]

Flanked by newly appointed Defense Minister Paul Quiles, Fabius said the truth about the Greenpeace affair had been hidden from a government investigator who was appointed in August to inquire into allegations of French involvement in the scandal.

Both Fabius and Mitterrand had pledged earlier to punish any French official found guilty of ordering the sabotage of the Greenpeace ship. Two French secret agents are awaiting trial in New Zealand on charges of murdering a Portuguese-born photographer for Greenpeace who was killed in the explosion.

Political analysts said that the government clearly was hoping to focus the blame for sinking the Rainbow Warrior on the General Directorate for External Security, the French military intelligence agency. The head of the DGSE, Adm. Pierre Lacoste, was dismissed Friday after he refused to reply to questions from the former defense minister, Charles Hernu, about the Greenpeace operation. Hernu resigned Friday.

Any attempt to blame the scandal entirely on the secret services, however, is certain to be strongly resisted by the right-wing opposition and the military, which traditionally has been mistrustful of the Socialists. In an effort to defuse potential protests from the Army and the opposition, Fabius indicated that agents who carried out the operation would not be prosecuted.

"The people who merely carried out the act must of course be exempted from blame, as it would be unacceptable to expose members of the military who only obeyed orders and who, in the past, sometimes have carried out very dangerous missions on behalf of our country," Fabius said.

Shortly before the prime minister's statement, government spokeswoman Georgina Dufoix reiterated that "neither the head of state nor the government gave the order to sink the Rainbow Warrior."

The government's initial inquiry revealed that funding for the operation was authorized by Mitterrand's top military aide, Gen. Jean Saulnier. The cost has never been officially revealed, but it has been calculated at around $400,000.

Saulnier, who has been promoted to chief of staff of the French armed forces, has insisted that his approval was limited to an increase in intelligence-gathering by the secret services against Greenpeace.

The Rainbow Warrior was sabotaged shortly before it was due to lead a flotilla of vessels toward the French nuclear testing center on Mururoa Atoll in the South Pacific to protest at the resumption of underground tests of nuclear weapons. A new Greenpeace fleet is now heading toward the area, despite a warning by Mitterrand that they will be prevented, by force if necessary, from entering French waters.

In his statement tonight, Fabius said that the government would order a thorough shake-up of the secret services and approve the creation of a special parliamentary commission of inquiry to investigate the Greenpeace affair. A new head of the DGSE to replace Lacoste will be named Wednesday.

Summing up what he said were the results of an initial investigation by the new defense minister, he said that the agents' sabotage of the Rainbow Warrior "was hidden from counselor of state Bernard Tricot."

Tricot, formerly chief of staff to the late Gen. Charles de Gaulle, was asked to look into newspaper allegations of French involvement in the Rainbow Warrior sinking. After interviewing senior officers in the Army and the DGSE, he published a report on Aug. 25 that cleared both the French government and the secret services of responsibility for the sabotage.

The report was met with widespread skepticism in France and was dismissed by New Zealand's Lange as "too transparent to be called a whitewash." While continuing to insist that he believed in the innocence of the French agents, Tricot conceded later that some of his informants could have lied to him.

The Greenpeace affair took on new momentum last week when several French newspapers, including the respected daily Le Monde, alleged that there had been a cover-up. Citing senior French officials who felt that the official line of defense was no longer tenable, the newspaper accounts said that more than 10 French agents were sent to New Zealand to sink the Rainbow Warrior.

Angered by the revelations in the press, Mitterrand complained in a letter to Fabius on Thursday that he did not have sufficient information to evaluate the new allegations. Insisting that "this situation cannot continue," he called for changes of personnel in the secret services. The following day, Hernu resigned after saying that he had incontrovertible proof that his subordinates had failed to tell him the whole truth about the sinking of the Rainbow Warrior.

French leaders publicly were rejecting charges of French involvement as recently as the middle of last week. On Sept. 19, Mitterrand asked New Zealand's prime minister to put a stop to "unfounded accusations" against France.

In its first reaction to tonight's statement by Fabius, Greenpeace pressed the French government to accept "moral and financial responsibility" for the damage to the Rainbow Warrior and the death of one of its crew.