Nearly two months after the Soviet invasion of Afghanistan, the major European allies are near agreement on a coordinated strategy for dealing with the crisis somewhat independently from the United States.

Based on the joint French-West German policy announced in Paris nearly two weeks ago, plus suggestions subsequently offered by Britain, the evolving strategy is intended to discourage the Soviets from trying to split the Atlantic Alliance while nevertheless charting a separate course for the Europeans.

British diplomats now are moving away from what has been Prime Minister Margaret Thatcher's outspokenly hawkish response to the Soviet action, which the other European allies mistrusted as a "Trojan horse" for U.S. pressure on them to follow President Carter's tough line.

At the same time, France and West Germany have moved closer to the British by publicly recognizing the Afghan crisis as a serious threat to detente and making clear to the Soviets that, despite European reservations about U.S. policy, they will fail in efforts to divide the alliance.

Rather than seeking to punish the Soviets with tough economic sanctions and uncompromising diplomatic hostility, the Europeans want to contain the crisis by warning the Russians, as the French and West Germans did in their Paris communique, that detente would be ended and war risked if there were any further escalation. They then want to join with the Soviets in exploring ways for them to withdraw their troops and restore the status quo in Afghanistan without threatening Soviet security.

The allies also want to work through a "division of labor" to strengthen European economic and political ties with potentially threatened nations in south Asia, the Persian Gulf and Africa.

The West Germans are concentrating on economic aid to Turkey and Pakistan, the French have a special relationship with their former colonies in Africa, and the British are renewing their interest in the Middle East and exploring possibilities for a new initiative on the Palestinian problem that troubles the Persian Gulf sheikdoms.

There is already a general consensus on most of this among Britain, France and West Germany, according to diplomats and analysts. They expect some statement of the European strategy at next week's meeting of the foreign ministers of the nine European Common Market countries in Rome.

One well-informed source here warned, however, not to expect "a complete package of all the details with a nice ribbon around it" in Rome. He said significant disagreements still exist on specific steps to be taken, including a coordinated European stand on participation in next summer's Olympic games in Moscow.

But a well-placed analyst here said that despite continuing surface tensions among the European allies and between them and the United States, "There is now a basis for cooperative European action that did not exist before."

Britain at one end of the spectrum and France and West Germany at the other have considerably closed the gap that had separated them during the Afghan crisis.

France and West Germany acknowledged in their Paris communique that the Soviet action threatened East-West relations instead of merely posing a problem for vulnerable Third World nations. Britain, meanwhile, admitted privately that it jumped out too far in front of the other allies in what seemed to be slavish support of the United States.

Actually, sources here now say, Thatcher was only following her own hawkish instincts rather than toeing the U.S. line in reacting so quickly and aggressively. British officials were acting in a vacuum, without a clear lead from the Carter administration or consultation with the other European allies, according to these sources.

To make amends, British Foreign Secretary Lord Carrington surprisedd the other Common Market foreign ministers at their last meeting in Brussels on Feb. 5 by warmly welcoming the Paris communique of the French and West Germans, which had only been made public that noon.

Carrington then offered a list of "principles" for incorporation into a European strategy to be worked out by the foreign ministers of the nine Common Market countries, Britain, France, West Germany, Italy, Belgium, the Netherlands, Luxembourg, Denmark and Ireland.

These principles stressed that the nine should arrive at a "harmonized" European position, that the situation in Afghanistan can be altered by a combination of Western pressures and enticements, that detente remains a "fundamental" goal of the nine European nations, that they will continue to support their "friends" in the Third World and that they will cooperate as closely as possible with the United States.