The United States told the Soviet Union today that Moscow had made "a terrible miscalculation" in invading Afghanistan. U.S. Ambassador Donald McHenry also warned Third World countries that none of them will be safe "if the international community appears to condone" the Soviet action.

Speaking on the second day of the Security Council debate on Afghanistan, McHenry went to great pains to make the U.S. case that the Soviet action was a premeditated invasion and coup rather than a strike against outside elements at the invitation of the Afghan government, as Moscow has claimed.

Behind the scenes, meanwhile, Pakistan, China, the United States and other Western countries tried to stiffen the resolution being drafted by Bangladesh and the other nonaligned members of the council by inserting a specific reference to the Soviet invasion.

But the nonaligned nations resisted attempts to mention the Soviets by name and submitted a resolution that "deeply deplores the recent armed intervention in Afghanistan" and "calls for the immediate and unconditional withdrawal of all foreign troops from Afghanistan." The Soviets said today they would veto this resolution, thus paving the way for a shift of the debate to the General Assembly, where there is no veto.

U.S. diplomts said it was likely the resolution would be voted on Monday morning, to clear the way for renewed consideration of council sanctions against Iran in the afternoon.

U.S. officials expressed confidence that they would have the nine votes necessary to adopt sanctions, but recognized that changed circumstances resulting from the crisis in Soviet-U.S. relations would increase the possibility of a Soviet veto.

Thus far, more than 20 nations have spoken in the council against the Soviet intervention in Afghanistan, while only Soviet Bloc delegates and the representative of the new Afghan government have attempted to justify the Soviet action. The council adjourned for the day at 6:25 p.m.

McHenry, the first speaker today, said the "blatant act of aggression" against Afghanistan began Dec. 25 when a massive airlift brought 10,000 Soviet troops to Kabul. It was a Soviet unit, he said, that surrounded the presidential palace there on Dec. 27.

"Afghan soldiers defending the palace were attacked and overcome," McHenry said, "and President [Hafizullah] Amin was summarily executed."

He also warned that additional Soviet divisions may be moving across the border at Kushka and Termez to reinforce the estimated 30,000 to 40,000 Soviet troops still fighting "in several areas of the country."

The ramifications of Moscow's action are vast, McHenry said, "for no state will be safe against a larger and more powerful neighbor if the international community appears to condone the Soviet Union's armed intervention. This must be of particular concern to states whose territory lies near the Soviet borders."

The wider implications of the Soviet action were also raised by other speakers today including Australia, Singapore and Liberia. Ambassador H. D. Anderson of Australia warned that the encouraging cooperation between Moscow and Washington on arms control and other issues "is now in jeopardy and we face the specter of dangerous confrontation."

Council action on Iran Monday was mandated by a resolution adopted Dec. 31, giving the Iranian government one week to free the U.S. hostages before council acts on sanctions.

Although the council is likely to meet to hear a report by Secretary General Kurt Waldheim on his trip to Tehran, no vote on sanctions is expected until later in the week.