The dramatic return to France of a former Gestapo officer known as the "Butcher of Lyon" seems set to reopen a painful debate here over the extent of French cooperation with Nazi Germany during World War II.

After being flown back to France from Bolivia aboard a French military DC8, Klaus Barbie was today preparing to defend himself on charges of "crimes against humanity" involving the killings and deportations of thousands of Jews and resistance fighters. He spent his first night in French custody at the Montluc Prison in Lyon, which served as Gestapo headquarters during the war and through which many of his victims passed.

French legal experts said that preparations for Barbie's trial could take many months in view of the time that has elapsed and the difficulty of finding living witnesses. It is likely to be the most important trial of a Nazi official since that of SS Col. Adolf Eichmann, who was kidnaped from Argentina by Israeli agents in 1960 and returned to Israel where he stood trial and was hanged in Tel Aviv in 1962.

The 69-year-old former Gestapo chief in Lyon has twice been condemned to death in France in his absence for war crimes, but the time for implementing the sentences expired in the early 1970s. Capital punishment was abolished in France in 1981, so the maximum punishment he faces is life imprisonment.

Barbie's sudden deportation from Bolivia, where he had lived as a well-connected German businessman for more than 30 years, was welcomed by all shades of political opinion in France and by all organizations of war veterans. It is also being hailed as a major diplomatic triumph achieved by a Socialist government that faces a crucial test of public opinion in regional elections next month.

In a statement, Prime Minister Pierre Mauroy said that the French government had not been motivated by a spirit of vengeance in seeking Barbie's deportation. "It simply had a double concern: to allow justice to be done and to be faithful to the hours of mourning and struggle . . . of those on account of whom France saved its honor."

The Barbie affair could have mixed political implications in a country whose record in World War II is still a sensitive issue. Nearly 40 years later, accusations of collaboration with the Germans are still common political currency.

One of the principal charges against Barbie is that he was responsible for the death from torture in 1943 of Jean Moulin, the first leader of the French resistance. Moulin, who is regarded as a national hero in France, is believed to have been betrayed to the Nazis by a fellow resistance fighter. Moulin never talked under interrogation.

Both right and left in France have sought to lay claim to the Moulin legacy. He was parachuted into France on the orders of Gen. Charles de Gaulle with the task of uniting the disparate resistance groups, and formed friendships with such men as the present Socialist minister of the interior, Gaston Defferre. One of President Francois Mitterrand's first gestures on coming to power in May 1981 was to pay homage at Moulin's tomb in the Pantheon in Paris.

It now seems clear that Barbie's expulsion from La Paz was the result of several weeks' careful planning by the French and Bolivian governments. His original arrest on Jan. 25 on a fraud charge was evidently a ruse and a way of preparing Bolivian public opinion for his expulsion.

Barbie, who became a Bolivian citizen in 1957 under the assumed name of Klaus Altmann, enjoyed good relations with successive military governments in La Paz. Several requests by France for his extradition were rejected--but the political climate in Bolivia changed dramatically when a civilian government came to power in October.

West Germany had also sought Barbie's extradition.

Barbie's return to face trial in the city he is alleged to have terrorized would not have been possible without the painstaking work of Beate and Serge Klarsfeld, who tracked him down to South America in 1971.

The Klarsfelds have accumulated evidence that they say shows Barbie was a major war criminal. He is said to have been responsible for more than 4,000 murders, 7,500 deportations and 15,000 arrests. Many of the Jewish deportees died at Auschwitz and other concentration camps.

Barbie, who was interrogated for the first time last night by French justice officials, has formally denied the charges.

Barbie's trial could shed light on allegations that the U.S. authorities helped protected Barbie after the war in return for information about SS officers active in East Germany. Serge Klarsfeld, who will represent many of the victims at the trial, said Barbie worked for a time for the American occupation authorities.

Klarsfeld's claim that the U.S. authorities granted Barbie effective immunity was supported by a man who said he was a former U.S. counterintelligence officer. In an interview with NBC News in New York, Erhard Dabringhaus, who is now a professor at Wayne State University in Detroit, said Barbie was a paid informant of the American government in 1948.