South African Foreign Minister Pik Botha will pull out of crucial talks on Namibia independence with the five major western nations today, the South African delegation said last night.

The move was a sharp setback to the highest level attempt by the United States and its allies to bring about a peaceful solution to the decade-long struggle for independence for Namibia, administered by South Africa in defiance of U.N. directives. Secretary of State Cyrus R. Vance was called from a private dinner to consult with some of the other foreign ministers from Britain, France, West Germany and Canada, attending the meeting.

French Foreign Minister Louis deGuiringuad said he was "shocked" by the move. The foreign ministers' talks started yesterday and had been designed to continue at least through today. The five ministers held two rounds of separate talks yesterday with Botha and Sam Nujoma, head of the Southwest Africa People's Organization (SWAPO), which has been fighting a guerrilla war for independence.

Sources close to the South African delegation quoted Botha as saying that he did not want his departure to be interpreted as a walkout, but that "new proposals" had been made in the talks that made it necessary for him for to consult with South African Prime Minister John Vorster.

The South African delegation declined to give details of the new proposals. The key issues in the talks are the withdrawal of most of South Africa's 20,000 troops, limitation on movement of the rest and establishment of a U.N. peacekeeping force leading to free elections. The western proposals had previously been given to both the South Africans and SWAPO.

French Foreign Minister de Guiringaud said, however, "No news proposals were made. We have put to Botha our original proposals. It is possible his instructions did not reach that far."

American sources also said there had been no new proposals.

A South African source said: "our positions were too disparate," citing specifically the issues of troop withdrawal and the port of Walvis Bay, which both sides claim. "We are so far apart that we have to go back."

A British source questioned whether Botha actually lacked sufficient flexibility to negotiate or whether his sudden departure was "a piece of theater rehearsed ahead of time, to allow South Africa to go through with its 'internal solution,'" a reference to South Africa's plan to establish a government without U.N. approval.

Another Western source suggested that Botha, who is regarded as a moderate in South Africa, might have deliberately chosen to appear as a tough negotiator for his home audience.

This weekend's talks were regarded in many quarters as a "make or break" effort by the West to reach agreement for the territory, which is twice the size of California, but only has a population of 850,000, about 90 percent black.

The United Nations and the International Court of Justice have long demanded that South Africa grant independence to the territory, formerly the German colony of Southwest Africa. After years of sporadic negotiations. South Africa has vowed to pull out by the end of the year on its own terms - unless an internationally agreed settlement can be reached.

South Africa refuses to deal with SWAPO, recognized by the United Nations as the sole representative of the Namibian people, as long as its forces carry on warfare.

Failure of the talks would probably cause South Africa to go ahead with its own "internal solution" to the problem by making a deal with black tribal groups and whites within the country in the same fashion that Prime Minister Ian Smith is attempting in Rhodesia.

Such a South African action would in turn most likely lead to a full-scale civil war by SWAPO, against a Namibian government that would probably be rejected internationally as a creation of South Africa.

The implicit message the West is undoubtedly giving South Africa this weekend is that such a scenario would lead to considerable Third World pressure to impose some measure of sanctions on South Africa, including the possibility of a ban on international investments.

The consensus of the top-level diplomats before it was announced Botha would leave was that it was too early to tell what the outcome would be, as Vance put it.

U.S. Ambassador Andrew Young, always the optimist, said the sides are moving and that although the negotiations were "tough", he felt the results would be a "step forward."

British Foreign Secretary David Owen said the talks could have "a profound impact" on the current negotiations in Rhodesia and on the internal scene in South Africa.

He noted the similarity of issues in Namibia and Rhodesia, dealing with "armies and possibility of rigging elections. It's just like I'm back in Malta," where he and Young held talks last month on Rhodesia.

Like Rhodesia, the basic problem in Namibia is a lack of trust between the two sides. South Africa has imprisoned numerous SWAPO officials and SWAPO has accused Pretoria of torturing detainees. South Africa accuses SWAPO of using terrorism to prevent blacks from dealing with the white minority government.

The question of withdrawal of most South African troops, estimated at upwards of 20,000, is the key issue dividing the two sides. The western proposal, still secret, reportedly calls for the number to be reduced to 1,500 immediately. South Africa has indicated it is willing to draw its forces down but not that far before holding elections for an assembly to draw up a constitution.

SWAPO is insisting on the 1,500 figures and is reportedly calling for the presence of at least twice as many U.N. peacekeeping troops.

SWAPO fears that the presence of a large South African military contingent during the election process would influence the vote. South African has little confidence that the U.N. forces, which will probably have heavy Third World representation, would be effective in stopping the infiltration of SWAPO guerrillas - something South Africa fears if its troops are greatly reduced.

Aside from Vance, de Guiringaud and Owen, the other western foreign ministers attending the meeting are Hans-Dietrich Genscher of West Germany and Donald Jamieson of Canada. The ministers held two sets of separate meetings with the South African delegation led by Botha, and with SWAPO, headed by Sam Nujoma, president of the group.

The western ministers also met with representatives of Nigeria, Gabon and Mauritius, plus the five "front line" nations - Angola, Mozambique, Tanzania, Zambia and Botswana.