Paris — When asked recently about how he was going to deal with the ailing French economy, President Francois Mitterrand compared his task to competing in the Tour de France bicycle race.
''The object is always the same,'' he said. ''Only sometimes you are on flat ground and sometimes you are pedaling uphill.''
Recent events make it clear that Mr. Mitterrand and his Socialist government have switched gears and begun to head uphill, only to find the hill steeper than they thought.
To bolster the weak franc and bring France's high 14 percent inflation rate under control, the Socialists have been forced to abandon their expansionary policies and preach economic austerity. This about-face has put President Mitterrand on the defensive, evoking sharp criticism from his supporters on the left and reviving the conservative opposition's will to fight.
Although Finance Minister Jacques Delors first said austerity was just to be ''a small electroshock'' consisting mainly of a four-month wage and price freeze , it is now evident that the government has in mind a long period of belt-tightening. At the end of last week, Mr. Delors admitted that there would be at least 18 months of austerity.
[A Mitterrand Cabinet reshuffle, said by Prime Minister Pierre Mauroy to close ranks around the government's austerity program, has given Mitterrand's chief of staff, Pierre Beregovoy, the additional post of minister for social affairs. Research Minister Jean-Pierre Chevenement was given the industry portfolio as an additional duty. And Jacques Attali, 38, one of Mitterrand's most trusted advisers, was appointed acting chief of staff May 30 and was expected to be confirmed in the job.]
Wage and price controls remain scheduled to be officially lifted after Oct. 31, but Mr. Delors said the government will allow neither prices nor wages to rise much after that date. In addition, austerity means trimming government expenditures through 1983, increasing the sales tax next month, and raising employees' and employers' contributions to balance the deficit-ridden social security and unemployment benefits programs.
Opposition among Mr. Mitterrand's supporters as well as his opponents grew as it was recognized last week that this austerity program was stern stuff. For the first time since the Communists joined the Socialists in the government, Communist Party leader Georges Marchais publicly criticized the government.
''We cannot accept in any case a law that blocks any increase in salaries and suspends free wage bargaining,'' Mr. Marchais wrote in the party paper, L'Humanite. There was no sign that the Communists were preparing to leave the government immediately, but they were obviously distancing themselves from the Socialists in preparation for next March's municipal elections.
Also revving up for those elections was the opposition. After a year of scattered and ineffective criticism, the conservatives displayed a new vigor in pouncing on the news as proof that the Socialists were mismanaging the economy.
Former President Valery Giscard d'Estaing offered his most sustained criticism of the government. He wrote a three-part newspaper series, delivered speeches, and gave interviews, all with the same message: The Socialists are ruining France's economy, turning her into ''a second-rate nation.''
The opposition even felt confident enough to challenge the government in the National Assembly. Jacques Chirac, leader of the Rassemblement pour la Republique party, called on the National Assembly to censure the government for its economic policies.
Looking directly down from the speaker's podium at Prime Minister Pierre Mauroy, Mr. Chirac said, ''You have demonstrated your incompetence for too long to restore confidence easily.'' He concluded, ''France has taken the wrong direction.''