France refused today to line up behind President Carter's program of economic countermeasures against the Soviet Union for invading Afghanistan.

The French position contrasted dramatically with the solidarity expressed by Britain and West Germany. Although French Foreign Minister Jean Francois-Poncet argued that the opposite is the case, French prestige in the Third World may complicate the attempts to form a united front of nations against the Soviet action. Francois-Poncet expressed disapproval of the Soviet invasion in relatively mild diplomtic language suggesting the Soviets had lied to France about the Afghan situation.

But, as the "witness" and originator of East-West detente 15 years ago, France is duty-bound not to act hastily, Francois-Poncet told reporters in a radio interview.

It would be a "grave error," he said, to "Westernize the Afghanistan affair," since it appears primarily as a conflict between the Soviets and the Islamic world rather than an East-West confrontation.

Francois-Poncet's description of French policy was the most striking example of a number of recent instances in which France has appeared to be signaling the Soviet Union that it wants to reestablish Franco-Soviet ties on a basis separate from Soviet relations with the rest of the Western allies.

The French also have been stressing the dangers of world war in a way that seemed to be a warning to President Carter not to go too far. In his traditional address to the French people on New Year's Eve, President Valery Giscard d'Estaing said: "The danger of war exists. We live in a period when the world's equilibrium rests on the capacity for self-control of a few men."

Giscard told guests at a New Year's Eve reception that the Soviet move into Afghanistan appeared to him to have been "improvised" rather than carefully planned. He backtracked by having his spokesman say he was speaking off the cuff and had not intended to express a considered judgment.

France's failure to sign the request by 50 nations for a U.N. Security Council debate on Afghanistan was explained away by French officials as being the result of France's position as current chairman of the council.

French refusal to approve the U.S. statement after a meeting in London of seven leading allies that they had agreed to "review" their relations with Moscow was explained as a reluctance by France to do anything that could be interpreted as reintegration into NATO. The French reject allied military integration but maintain their position as political allies in the Atlantic Alliance.

Francois-Poncet said tonight that the meeting in London, preceding a similar meeting of all 15 NATO allies in Brussels, was held at French insistence before Brussels to underline the French refusal to consult inside the NATO forum on the future of detente.

In another move that stressed the difference in the French approach, Giscard invited socialist leader Francois Mitterrand and communist leader Georges Marchais to send representatives to consult with Francois-Poncet about France's information about Afghanistan.Both men are expected to run as candidates against Giscard in the 1981 presidential elections.

The French Communists are the major West European party that has lined up the most unquestioningly behind Soviet justifications of the invasion. Since the Soviet move, Marchais has agreed to advance a visit he was scheduled to make to Moscow, his first there since 1974. He is expected to go Monday after a hurried weekend trip to Rome to see Italian communist leader Enrico Berlinquer, whose party has strongly condemned the Soviet invasion.

Giscard has been widely accused of overdramatizing the dangers of war in an effort to erase the effects on public opinion of a recent series of scandals involving his government and himself.

Francois-Poncet said tonight that France would vote for a Security Council resolution calling on the Soviets to withdraw from Afghanistan. He also said France would not take commercial advantage of the gap created by the U.S. cancellation of deliveries of grain or technology to the Soviets.

Francois-Poncet said he wondered whether it is good for the furtherance of Western values in the world if the West presents itself as a united bloc. Speaking of France's "original and attractive image," he said the French enjoy the great advantage in the Third World of not being suspected by anyone of harboring imperialistic designs.

Throwing out detente overnight would be "frivolous," he said. France therefore will talk at length with the Soviets to sound out their true intentions and to try to get them to reconsider their actions. He said France will take some time for reflection before deciding its long-term view on the future of detente.