The U.N. Security Council yesterday appeared ready to press ahead with its plan for bringing independence to the disputed territory of Namibia (Southwest Africa), setting up a major confrontation with the new prime minister of South Africa.

Outgoing South African Prime Minister John Vorster, who announced his resignation Wednesday, rejected the U.N. plan as his final act in office, and announced that South Africa would follow its own course in loosening its control over the territory.

However, the United States and four other major Western powers - which had worked for 18 months to devise a formula accpetable both to South Africa and the Southwest Africa Peoples Organization (SWAPO) guerrillas - made it clear yesterday that they intended to move ahead with their plan.

During a day of "urgent consultations" at the United Nations, the western powers and key African countries agreed on a three-stage course of action which was expected to be formally presented to the U.N. Security Council by the middle of next week, sources said.

They said the Security Council would be asked to endorse Secretary General Kurt Waldheim's plan to create a 7,500-man U.N. peace-keeping force for Namibia, which would maintain order in the territory during the transition to independence.

At the same time, the Security Council would condemn South Africa for rejecting his plan, and call on the South African government to accept the U.N. peace-keeping force, the sources said.

Diplomatic sources said the five Western nations would follow up this action by presenting a demarche to the new South African prime minister - who is scheduled to be chosen Sept. 28 - warning that "dire consequences" could follow an ultimate rejection of the U.N. plan.

While Western diplomatic sources said yesterday there had been no specific discussion of what might constitute "dire consequences," State Department spokesman Thomas Reston noted that "the question of sanctions is bound to come up" in U.N. discussions.

"The South African decision on Namibia clearly places a major obstacle in the path of an internationally acceptable settlement," Reston said. He added, however, that the United States remains "hopeful that a resolution of this apparent impasse can be found."

"We remain committed to the Western contact group plan which South Africa accepted in April, and we are hopeful we can carry this through to a peaceful resolution," Reston said.

Although South Africa originally agreed to the main provisions of the U.N. plan, Vorster indicated yesterday that disputes over its implementation led to its decision to proceed on its own.

South Africa had earlier indicated dissatisfaction over the size of the peace-keeping force proposed by Waldheim, which would make Namibia the largest United Nations operation since U.N. groops were sent to restore order in the former Belgian Congo.

South Africa also was unhappy over the U.N. plans to hold elections for a Namibian constituent assembly next spring, fearing this would give SWAPO candidates additional time to gain support within the territory. In his announcement yesterday, Vorster said elections would now be held in Namibia Nov. 20 to 24.

The other Western powers also condemned Vorster's action yesterday. African nations bitterly denounced the move at the United Nations.

"South Africa has shown a death wish," declared Nigerial Ambassador Leslie Harriman. "It is nothing less than a declaration of defiance and war against the Namibian people, the U.N. and the world."