Promises of independence and a mining boom have transformed the disputed territory of southwest Africa into a corner of intrigue, escalating guerrilla warfare and quiet but intense rivalry for commercial advantage.

The maneuverings for position here in the dusty shopping center that serves as the capital city of the territory are a minor key variation on postwar Vienna. Nobody seems quiet sure what everybody else is up to, and things are rarely what they seem.

Even the name is disputed. The United Nations and African states have already freed the territory from South African control - on paper - and renamed it Namibia. South Africa has finally promised to withdraw, but continues expanding its main military base complete with underground hangers for combat aircraft and facilities for up to 20,000 South African troops.

Wealthy American companies like Bethlehem Steel, American Metals Climax and Phelps and Dodge are already implanted here, but their names do not appear on the formal roster of mining companies.

New York lawyers and public relations experts fly out to this commercial outpost on the edge of the Kalahari desert to help African chiefs and white farmers draw up a constitution designed in part to draw yet more Western ccompanies and political help. The Americans say they donate their services, but their presence has stirred predictable suspicions of hidden motives.

While it may sound like a poorly constructed Evelyn Waugh novel, the struggle over this former German colony involves enormous stakes, including vast deposits of uranium, diamonds and other minerals.

For the 900,000 people who live in the territory, also at stake are an end to the officially sanctioned racism the South African government installed here as well as an end to the destruction and death visited on black civilians by Marxist-backed guerrillas operating out of Angola and by the white South African troops opposing them.

As large as Texas and Oklahoma combined, the 310,000-sqare-mile territory was colonized by imperial Germany late in the 19th century and captured by South African troops during World War I.

The League of Nations gave Pretoria a mandate over the territory. After World War II, South Africa refused to recognize the United Nations' authority over the territory and began to implement is aparthelid policies here.

This triggered bitter international and domestic disputes that are now coming together as South Africa's Prime Minister John Vorster, reversing field, has said he hopes to grant independence to the territory by Dec. 31, 1978.

The United Nations voted in 1966 to end Pretoria's mandate and to take theoretical responsibility for Namibia's future. This and International Court decisions led the United States to take an uncharacteristically tough position in asking American companies to avoid doing business in the disputed territory and ruling out government loans and guarantees for companies that did.

This may help explain the reticence of some American companies to use their own names for their Southwest African operations. Bethlehem Steel, for example, is prospecting here as Ebco Mining Ltd. American Metals Climax and Newmount Mining own a majority of the territory's biggest copper mines, which are run by Tsumeb

Most companies operating here have reaped impressive profits while ignoring their government's admonitions. A Canadian company, Falconbridge Ltd., "told the Canadian government to shove off when they tried to pressure the company to stay out, and they've been getting back 14 per cent a year on their investment," says one mining executive.

But the American effort to discourage new investment has had an effect, according to Des Matthews, director of the territory's Association of Mining Companies.

"We've got copper, vanadium, diamonds and major deposits of uranium here just waiting to be mined," Matthews said in his office. "We've got the most lenient leasing and concession licensing system, and taxes that give you tremendous advantage."

American companies "are lining up now to get in here once we get independence," Matthews continued emphatically. "Once we get five or six large American companies in here to put in the needed infrastructure, we'll be able to provide jobs for our black population and uplift them."

He stressed the rising value of uraniun to South Africa and the West. The projected output of 5,000 tons a year of raw uranium from the newly opened mines at Rossing will soon equal the uranium output of South Africa itself. The United States has been selling South Arica enriched uranium under South Africa's control.

An independence settlement palatable to Western and moderate African states would not only open the way for increased investment but might also lead to an important railway link with Botswana and other African countries being restablished, Matthews said.

To keep a Western presence in the disputed territory, the South Africans have allowed more liberal repatriation of profits by outside mining companies here than they do in the republic. Economist Francis Wilson estimates that 25 per cent of the territory's gross domestic product goes abroad in profits, dividends and interest payments. The figure for South Africa is 4 per cent.

A government-financed and-sponsored conference has been plodding through the drafting of a constitution for the past 16 months. The object is clearly to come up with a formula that will win outside undercutting Vorster's position at home in his all-white, apartheid-supporting Nationalist party.

The conference is composed of 11 delegations summoned by the local branch of the Nationalist party, which sent a white delegation and invited leaders from eight African tribes and two mixed-race communities.

Despite efforts by some of the black delegations, they still do not have a firm commitment from Vorster to get the local whites to abandon racism and to accept an effective central government to run the country.

Vorster has said that it is up to the people of the territory to decide what they want. But the actions of South African security officials here strongly suggest that Pretoria will intervene to prevent an outcome that it does not like.

When A.J.F. Kloppers, leaders of one of the mixed-race delegations, began to speak out forcefully in October about the need for drastic changes here, South African policemen reminded him of an old fraud charge against him and of the fact that they could deport him back to South Africa immediately, although he has spent most of his adult life here.

"I won't be intimidated," Kloppers said in confirming the threat, "I have done nothing wrong. They know my lawyer cleared that up long ago." But since the incident, he as muted his criticisms of the way whites are directing the conference.

The money and effort being expended to build up Chief Clemens Kapuuo as a potential prime minister or president has stirred suspicions by Kloppers and other delegates that the Herero chief is being backed by mining companies or the American government.

Kapuuo has set up the K F Kudu Foundation to raise funds for him in the United States, and a party staged by public relations man Jack Summers in New York for Kapuuo last year drew Elizabeth Taylor and other celebrities.

"I wanted advisers opposed to South Africa's apartheid," Kapuuo, a big, slow speaking man, said. "I am impressed by what Americans are trying to do in their own country."

Summers asserted in New York to William Claiborne of The Washington Post that he was receiving no nomey for his "marketing" of and travel for Kapuuo, the leader of "the moderates." "We are not in any way connected with the U.S. government." Summers said of his year-old Psychographics Communications Inc. (Psycom) organization, which became involved with kapuuo shortly after Henry Kissinger and Vorster discussed Southwest Africa for the first time.

Advising Kapuuo at conference sessions are Arnold Burns or Stewart Swartz of the New York firm of Burns and Jacoby, international law specialists. They have drawn up plans for an interim government and presented them at the constitutional conference.

Burns, who said that his firm absorbs the costs involved in this work, also asserted that "we receive no money, encouragement, help or any form of assistance in any nature from any government, including the United States government."

The $100- to $200-a-day, legal experts for most of the other delegations are paid by the South African government, according to delegation leaders.

While the talks drag on over ending South Africa's nominal political control, Pretoria continues to reinforce its military forces in the territory, which served as the base from which South African troops struck in neighboring Angola during the civil war there.

The South Africans turned back after the Soviet Union and Cuba intervened to protect the Popular Movement government in Luanda and Cuban units advanced to the border.But American visitors report a major extension under way at the South African base at Grootfontein in Ovamboland, and a clergyman who visits the area regularly says that "As crazy as it may seem, the South Africans act like they want another go into Angola."

"Certainly the South African troops will stay after independence," white delegation leader Dirk Mudge said. "We will need protection, and I haven't heard anybody else offering to help provide it."

Mudge's comment and the buildup itself indicate that even if an internal settlement that could be sold to the West can be achieved. South Africa does not expect the South-West African People's Organization (SWAPO) to approve it and stop the low-level guerrilla warfare they carry out inside the territory.

SWAPO's rejection of an independence formula decided on here would present a major stumbling block to international recognition.

Founded as a black nationalist political organization, SWAPO was radicalized by the harsh police ation directed against it, and turned into a guerrilla movement increasingly dependent on the Soviet Union for arms and training. Morever, it has been recognized by the United Nations as the main representative of the territory's inhabitants.

SWAPO has refused to participate in the constitutional talks, asserting that it will negotiate only with the Vorster government for "real independence." Kissinger reportedly attempted to work out a formula to split off one faction of SWAPO and get it into talks with the South Africans, but Vorster told a recent visiting American official that he would never have anything to do with SWAPO, "which was founded by three white Communists and represents nobody."

The influx of 10,000 to 20,000 South African troops to confront the estimated 2,000 armed and trained SWAPO fighters has severly disrupted life in the Ovambo area of the north. The Ovambos provide SWAPO with most of its support.

Army reservists in South Africa admit that poorly trained and disciplined Citizen Force units have terrorized and abused villagers while carrying out the local equivalent of "search and destroy" missions in the north. Local cleregymen have collected detailed instances of the desecration of a black church by white troops and other ugly incidents.

The South Africans have cleared a mile-deep no-man's-land along the border, and have erected a double fence to try to keep the guerrillas out.

"Ten years ago, South Africa controlled this territory with 650 territorial policemen, half of them non-white," said one discouraged white settler here who is thinking of leaving. "Today, we don't know how many men it will take to get us to the end of the tunnel."