The Security Council opened its debate on the Soviet invasion of Afghanistan today amid a blast of cold war rhetoric and a signal that the nonaligned nations would ask for a resolution calling for the withdrawal of all foreign forces from the country.

Speaking for more than 50 nations that have signed up to protest Moscow's action, Egypt and Pakistan led the debate. Soviet and Afghan representatives defended the Soviet presence with the claim that "limited military assistance" had been sent at Afghanistan's request to protect it from "foreign aggression."

U.S. officials are unhappy with the working paper that Bangladesh and other nonaligned nations on the Security Council have drafted for a resolution that would not specifically name the Soviet Union. The Carter administration wants a clear condemnation of the Soviet occupation of Afghanistan.

But the nonaligned nations are reportedly not willing to back such a resolution. There is a strong possibility that the Soviets will veto even the nonaligned text in a vote not expected to come for several days.

"Even if the resolution does not mention the Russians by name, we all know who the foreign forces in Afghanistan are," said one U.S. official.

The Philippines said today that the council should consider the facts carefully before reaching any conclusions. Other Third World delegates said privately that "the situation is not totally clear-cut."

U.S. Ambassador Donald McHenry, who allowed the Moslem nations to take the lead today before he delivers his speech to the council Sunday, insisted that the debate was not an exercise in futility.

"Just because you know someone is going to be intransigent," he told reporters, "doesn't mean you shouldn't haul them before the bar of justice."

At the same time, the debate over Afghanistan cast its shadow over the voting for membership in the Security Council.

It was the desire to relaunch the Cold War, Soviet Ambassador Oleg Troyanovsky charged, that caused the Americans, Chinese, British and those supporting them to convene the council "to further their imperialistic and hegemonistic designs."

Troyanovsky said the United States and other Western countries had "a direct role in arming, training and supplying Afghan counterrevolutionaries."

He warned that the Soviet Union "will not allow Afghanistan to become a beachhead for imperialist aggression against the Soviet Union."

The Soviet ambassador said the United States had brought the Afghanistan issue to the Security Council only "to camouflage the genuine American military threat that hangs over Iran and to hide America's intention of destabilizing the entire region."

Shah Mohammed Dost invited Amnesty International and the International Red Cross into his country to see the freedoms that he said had been restored to the people after the overthrow of the "fascistic regime" of Hafizullah Amin on Dec. 27.

Egypt was the bluntest of the initial group of speakers. Ambassador A. Esmat Abdel Meguid said that "the Soviet invasion of brotherly Afghanistan is nothing but a manifestation of a policy of hegemonism. The simple fact is that a Moslem, nonaligned and peace-loving nation is faced with an invasion from its superpower neighbor aimed at imposing by force a certain ideological regime against the will of its people."

Chinese Ambassador Chen Chu said that the Soviet Union was forced "to put a fig leaf over its naked acts of aggression." What is most serious about the Soviet action is that it "demonstrates its readiness to repeat the same exercise in the future and to invade and occupy any country it pleases."

British Ambassador Sir Anthony Parsons said, "The Soviet Union has mounted for the first time a massive armed invasion of an Asian nonaligned state -- a state not directly within its sphere of influence."

The council is scheduled to meet Sunday at 11 a.m., with the United States as first speaker.

In another development, some Third World countries switched their votes from Cuba to Colombia in the latest series of secret ballots to select the 15th member of this year's Security Council.

This stalemate has gone through 154 ballots, with the Cubans generally getting about 90 votes, still short of the required two-thirds majority. Yesterday, however, the Cuban total fell to 70 -- obviously because of the invasion of Afghanistan and the Cuban link to Moscow.