The top-level Western mission to pressure South Africa into accepting a U.N. independence plan for Namibia evidently ended in failure yesterday, despite an offer from Namibia evidently ended in failure yesterday, despite an offer from President Carter for improved relations with the United States.

The offer was contained in a personal letter from Carter handed Monday to South African Prime Minister Pieter W. Botha by Secretary of State Cyrus Vance. Conference sources said the letter implied the United States, which has been a vocal critic of South Africa, would not bring the international pressure it has used on Namibia to bear on internal South African racial politics.

The lack of movement in five days of talks here could lead to an international confrontation, including demands from black African governments for economic sanctions against the white minority South African government.

This would threaten Washington's Southern Africa policies based on efforts to keep the dispute with South Africa peaceful in the hope of resolving the Namibian problem without the kind of guerrilla warfare plaguing Rhodesia. The talks here had been billed as a major test of those policies.

Vance and envoys from Britain, Canada, France and West Germany flew out of Pretoria last night with what sources said was little hope that the South Africans will agree to the U.N. plan that has been cornerstone of the American approach.

The South Africans appear determined to go ahead with their own internal elections in December for a local administration in Namibia, which South Africa will recognize as an independent nation. This move is generally regarded as an attempt on Pretoria's part to prevent the black nationalist movement, the South West Africa People's Organization (SWAPO), from participating in elections.

The South Africans are still weighing the last set of compromise proposals from the West to break the deadlock over the election. At final answer is expected after a South African Cabinet meeting today. Botha and his foreign minister, Pik Botha, met last night with political parties from South West Africa, the South African name for Namibia.

Well informed observers predict the South African government will make a statement that will not be an outright rejection of the U.N. plan, but rather a repetition of its stance up to now that the elections in December must be held, with the door open for further negotiations. This is effect means the talks failed, since this was the impasse that prevailed before the conference began.

The Carter administration's offer, which also included the promise of an invitation to the United States for Bothat evidently is an attempt to win concessions from Pretoria that public criticism and threats of isolation and economic sanctions have failed to get.

According to well informed sources, staff members of the five Western foreign ministers were uneasy over the accomodation the ministers displayed in meeting with the South Africans.

This spirit of accomodation became evident in the ministers' willingness to meet with the South African-appointed administrator general of Namibia, Marthinus Steyn. The five powers previously have refused to meet with Steyn, saying the South African government is the only proper authority in Namibia according to the League of Nations mandate under which it now administers the territory.

Some issues - including the size of a U.N. police force to supervise the elections and the degree of consultation between the South African administrator general and U.N. representatives - were easily resolved, sources said. But Western attempts to get South-Africa to call off the December elections, define it as merely a test of public opinion, or agree that it would have no meaning at all, were all rejected, they added.

Conference sources declined to say whether the Western coutries' veto power over economic sanctions at the United Nations was discussed. It was learned, however, that the Carter administration has drawn up a score or more sanction options, setting out their potential cost and effectiveness. One option under consideration is a move to deprive the government-run South African Airways of landing rights in member countries of the United Nations.

The Western approach reportedly dwelled on the probability of increased Soviet and Cuban involvement with SWAPO guerrillas fighting South African troops, and how this would lead to further conflict and destabilization in Southern Africa. A senior diplomat said "these serious consequences" of a South African rejection of the U.N. plan were fully discussed and he thought the South Africans were fully aware of them.