The United States and its European allies yesterday hailed the return of Greece to the North Atlantic Treaty Organization military alliance after a six-year absence, saying that the badly needed shoring up of NATO's vital southern flank could not have come at a better time with the turmoil continuing in nearby Southwest Asia.

In Brussels yesterday, NATO's defense planning committee quickly put its stamp of approval on the agreement, which was reached in the past few days between Greece and NATO and which Turkey's new military government accepted.

President Carter called the development "a great step forward for an adequate defense for the Southern flank of Western Europe."

Essentially, the action means that Greek forces are once more committed to the common defense and that the overall NATO commander in Europe, U.S. Army Gen. Bernard Rogers, who played a key role in the lengthy negotiations to bring Greece back into the fold, can now issue orders to those forces in an emergency.

Though Greece's army is relatively small, its air force and navy have sizable forces to contribute to the defense of the Mediterranean and Aegean Sea regions.

Politically, the reintegration of the Greek forces in seen as an extremely timely boost to NATO's frequently battered solidarity. Officials said they believed its significane would not be lost on Moscow. Those officials at the State and Defense departments yesterday portrayed the decision as a realization by Greece and Turkey of the difficulties the Western alliance has come to face in the past year or so, including the crisis in Iran, the Soviet invasion of Afghanistan, the death of the Yugoslavian leader, Marshal Tito, and now the Iran-Iraq war.

For the Carter administration, the signing caps an extensive patching up of U.S. relations with Greece and Turkey. The administration was able to get an arms embargo against Turkey lifted two years ago, and now officials anticipate that the new NATO agreement will speed renewal of U.S. base agreements with Greece within the next two or three months. The Athens government, in what apppeared to be public pressure tactics, had been threatening to close four main U.S. bases if the reintegration issue was not solved soon.

The Greeks have federal elections next year and it was widely believed that the conservative government of Prime Minister George Rallis did not want to go into the election with the question of NATO membership unresolved.

[In Athens yesterday, Rallis, said he would seek a vote of confidence in parliament to end Greece's six-year absence from the NATO military alliance, but he refused an opposition call for a new election.]

The Greeks, bitter and frustrated over their inability to halt the Turkish invasion of Cyprus in 1974 and unable to get the United States or NATO to stop it, pulled out of the 14-nation military alliance, much as France had done in the 1960s.

Greece had been pressing for reinstatement for the past few years but its efforts had generally met with a Turkish veto because of lingering disputes over the terms of Greek reentry. U.S. officials acknowledge privately that the fact that Turkey has had a military government for the past few months did have some effect in finally overcoming obstacles that thwarted an agreement in the past. In their view, however, the overall situation in Southwest Asia had more to do with the final Turkish decision to go along.

Officials here and in Brussels declined to provide any details on the terms of the reentry, saying that command arrangements between any country and NATO are classified. It is likely that details are being withheld because they may be politically sensitive.

Defense officials here said that large parts of the previous disputes with Turkey over the conditions of Greece's NATO reentry were settled, and that other parts remain to be worked out. But the key thing, the officials stressed, is that the terms were acceptable to both.

A key item of contention had been the degree of Greek or Turkish military responsibility and control over Aegean airspace and sea lanes. Press reports from abroad, which could not be immediately confirmed here, said Rogers' plan did not call for any specific areas of naval command, but rather would allow for the overall NATO sea commander to call upon either nation's forces as needed. Control over Aegean airspace also appeared to be aimed at striking a balance. A new NATO air command in central Greece will be set up to balance one in Turkey, sources here confirmed.