The nine Common Market countries agreed today on a European diplomatic initiative to try to solve the Afghan crisis by offering to guarantee Afghanistan's neutrality if the Soviet Union withdraws its troops from the country.

Among the possibilities reportedly discussed but not decided on today in a one-day meeting of the nine foreign ministers was sending United Nations peacekeeping troops into Afghanistan as the Soviets withdrew their troops, who are fighting Moslem rebels in the mountainous country on the southwestern border of the Soviet Union.

"If the Russians will move out," West German Foreign Minister Hans-Dietrich Genscher explained to West German reporters after today's meeting, "we will guarantee that others won't come in."

Genscher reportedly added, "What we are saying is that the major powers, especially the two superpowers, must declare Afghanistan off limits -- outside their spheres of influence -- and let that country adhere strictly to the principle of nonalignment."

Neither he nor other diplomats specified what other suggestions were made about the form a guarantee of neutrality could take.

"The plan is still in its infancy. The modality is still to be worked out," said British Foreign Secretary Lord Carrington, who suggested the strategy, which was unanimously approved by the other foreign ministers. This strategy will now be discussed with Secretary of State Cyrus Vance, who arrived in West Germany tonight to begin a round of meetings with his counterparts in Bonn, Rome, Paris and London.

Only the stubborn opposition of French Foreign Minister Jean Francois-Poncet prevented the nine from also agreeing on a statement that implicitly would have warned that their governments would advise their athletes to boycott next summer's Olympic Games in Moscow if the Soviets did not withdraw from Afghanistan.

"It was eight to one against France," according to one diplomat's account of the sometimes tense discussion of the Olympics.

According to sources, the proposed statement, agreed to by the other eight foreign ministers, would have recognized a "political dimension" in attending the Moscow games. It also would have favorably noted last Friday's resolution by the Common Market's elected but largely advisory European Parliament, urging athletes to stay away from Moscow and participate in alternative games being promoted by the United States if the Soviet troops are not withdrawn.

The French government is strongly opposed both to recognizing any connection between politics and the Olympics and to becoming linked to any of the Carter administration's retaliatory steps against the Soviet Union.

Other diplomats here, while supporting the proposed statement, also expressed reservations about advocating a boycott call that most of their national Olympic committees might well ignore.

Carrington said that while the European initiative on Afghanistan was pursued, the British government would continue Prime Minister Margaret Thatcher's policy of asking British athletes to boycott the Moscow games unless the Soviets withdraw from Afghanistan.

"Wouldn't it be nice though," Carrington added, "if because of this initiative everyone would be able to go to Moscow?"

Carrington said the aim of the British suggestion of a guarantee of Afghan neutrality was to enable the Soviets to withdraw "on a perfectly respectable basis" without losing face in the international community. He said the Soviets would welcome such an opportunity if they were truthful in their claims that "they are occupying Afghanistan only to guarantee their own security."

The British had consulted in advance on their suggestion with the French and West Germans, according to diplomats here. Carrington added that the Carter administration "knew it was coming." Genscher said the idea had been "aired" in the United States.

Diplomats here referred reporters to President Carter's White House press conference last Wednesday, when he was asked about "the kind of regime" he sought in Afghanistan.

"We would like to have a neutral country," Carter answered. "If there has to be a transition phase during which a neutral and responsible government might be established acceptable to the Afghanistan people, then perhaps some peacekeeping force as espoused by the United Nations, maybe comprised of Moslem military troops or otherwise, could be used during that transition phase."

Except for condemning the Soviet invasion of Afghanistan as a threat to detente and expressing their displeasure with Moscow in symbolic diplomatic acts, the European allies have refused to follow Carter in imposing severe economic sanctions on the Soviets or trying to force their athletes to boycott the Moscow Olympics.

The acceptance of Carrington's proposal today end Britian's isolation in Europe as an apparent hard-liner and accused "Trojan Horse" for American efforts to win European support for Carter's tough stand.

Except for the French refusal to agree to the implied Olympic boycott threat, the nine Common Market countries are now united on an evolving carrot-and-stick strategy offering the Soviet Union a positive inducement for withdrawing from Afghanistan while warning that the alternative could be a dangerous breakdown of East-West relations.