President Valery Giscard d'Estaing's decision to give the French capital home rule for the first time in a century has suddenly boomeranged on him and provoked a direct challenge to his leadership from his one-time allies the Gaulists.

The opening shots of the election campaign for mayor came this week as Gaullist leader Jacques Chirac, who quit as Giscard's prime minister last August, announced he would oppose Giscard's personally selected candidate for the job in the March balloting.

A victory would give Chirac a highly visible platform for a shot at the presidency himself in 1981. It would also make him the undisputed political campaign leader of the quarreling coalition of the Gaullist and centrist parties that Giscard needs to get his legislative program through the National Assembly.

For six centuries, the kings, emperors, prime ministers and presidents who preceded Giscard have been suspicious and fearful of granting to potential rivals the platform and the authority to run the capital of one of the Western world's most highly centralized nations.

They often had substantial reasons for such reticence. Etienne Marcel, who became the first municipal executive through his role as leader of the League of Merchants in 1357, was caught by King Charles V striking an abortive deal with the English to topple the French monarchy and take Paris.

Eight mayors shuttled through the stateley neo-renaissance City Hall overlooking the Seine in three years during the French Revolution. Some of them ended up on the guillotine.

Napoleon put City Hall out of business as a rival of the national government in 1800 by establishing the system of centrally appointed prefects, or civil administrations, who have run Paris since, with brief spells when mayors took over during the upheavals of 1848 and the 1870 Commune.

Giscard got the home rule bill through the National Assembly as part of a program of gradual reforms that he energetically launched after coming to office in 1974.

Since that confident beginning, the reforms have upset the more conservative Gaullists and weakened Giscard's standing with them, the economy has failed to revive as quickly as Giscard promised and a growing number of scandals and misadventures have stained the record of his government.

Giscard implicity acknowledged the importance of the mayor's job here by persuading one of his closest friends and a fellow aristorcat, Count Michel d'Ornano, the mayor of Deauville and minister of industry, to run for the post.

When d'Ornano, an untested campaigner, announced his candidacy in November, he asserted that he carried the endorsement of the "majority" coalition, which includes the Gaullists, the small Independent Republican Party of Giscard and d'Ornano and the Center Social Democrats of Jean Lecanuet.

But the Gaullists began to grumble seriously two weeks ago after d'Ornano began releasing the lists he had drawn up of the candidates to represent the majority in the 20 Paris districts that will elect 109 city council members who then elect the mayor. Independent Republicans took a lion's share of the city's safe districts.

Telling some of his advisers that "Giscard has set the mayoralty election as a trap" for the Gaullists "but it will turn out to be a trap for Giscard," Chirac reportedly decided last weekend to take on d'Ornano in a frontal attack that would finally settle his still smouldering fued with Giscard.

His announcement Wednesday stunned and angered the Elysee Palace. Giscard, who leaves Saturday for a four-day trip to Saudi Arabia, has not spoken out but his prime minister, Raymond Barre, has denounced Chirac's move and d'Ornano called a press conference to say that he honored his agreements and would stay in the race.

Chirac justified his decision to run by suggesting that only his candidacy would halt "the threat that the capital of France could fall into the hands of the Socialists-Communists." He also said that his candidacy would inject "new determination and vigor" into the preparations that must begin now for the National Assembly elections scheduled for 1978.

The Socialist and Communist parties are predicting that their coalition will win those elections and be able to force Giscard into appointing a leftist prime minister and government. Public opinion polls here show the left making gains, and one of the major reasons Chirac quit last August was Giscard's refusal to advance the legislative elections.

Chirac feels that the majority coalition is in a better position to make a strong running against the left now than it will be after another 18 months of Giscard's increasingly unsteady leadership.