A South African-backed coalition has won a controversial election in Namibia, boosting South Africa's hopes to install a moderate, independent government in the territory it has administered as Southwest Africa under a League of Nations mandate.

According to results announced today in Windhoek, the Namibian capital, the Pretoria-backed Democratic Turnhalle Alliance polled 82 percent of the vote to control 41 seats in the 50-member constituent assembly that is to meet for the first time next week.

The election was held against the wishes of the United States and the four other Western members of the U.N. Security Council, which have been negotiating with South Africa and the Southwest Africa People's Organization-the main Namibian guerilla group-to hold U.N.-supervised elections in the territory.

SWAPO and other opposition elements boycotted last week's election, and the five Western powers have said they will reject the election results and will continue to deal with Pretoria as the ruling power in Namibia.

The election of the Democratic Alliance-controlled assembly may complicate the ambitious Western diplomatic initiative, which is aimed at preventing an escalation in SWAPO's guerrilla war with South Africa.

To many observers, South Africa's insistence on holding the election demonstrated the limitations of the West's diplomatic leverage on Pretoria when South Africa is pursuing what it regards as its best self-interest.

There was little surprise at the victory of the multiracial alliance, formed over a year ago by nine ethnically based parties. From its inception, it has had the blessing of the South Africa government, and is widely believed to be financed by Pretoria.

Registration for the election was handled by South Africa officials. Those who publicized alleged irregularities in the registration drive were either ignored or deported, as was Anglican church activist Justin Ellis.

Ellis, in Washington to meet State Department and congressional officials as part of a tour of the five Western U.N. Security Council nations that have been working to achieve a Namibia solution, accused the South African government of intimidation before and during last week's vote, Washington Post staff writer Joe Ritchie reported. Ellis said South African troops and police beat and detained people suspected of being SWAPO supporters, often including anyone stopped at a roadback who was unable to produce a registration card for the election.

[The government also threatened Namibians with the loss of pensions, jobs or the right to hospital treatment if they did not vote, Ellis charged. Furthermore, he said election officials had the right to mark ballots for anyone considered illiterate-according to Ellis about half the population of Nambia.]

South Africa's only concession to the West was a promise to "use its best efforts" to persuade the election winner to go along with a second, U.N.-sponsored election.

South African Prime Minister Pieter Botha did not appear more committed to U.N. elections today when he said that he will hold talks with the new Namibian assembly next week that would touch on "possible international cooperation." South Africa has promised to complete consultations with the newly chosen body by the end of this month when it will report back to U.N. Secretary General Kurt Waldheim.

South African officials sa that recent election was necessary to appease moderate blacks and whites in the territory who fear a U.N.-supervised election will bring a SWAPO victory. Those moderates, now centered in the Democratic Alliance, will feel more secure and be more likely to run against SWAPO since their recent victory, they argue.

Others are more skeptical however. "Once they are in power, they won't want to face another election which might put them out of power," said SWAPO's information secretary, Peter Katjivivi.

Many observers expect South Africa to go to Waldheim with a list of "alterations" in the @u.n, plan demanded by the alliance as a condition tempts to get SWAPO and the black African states to accept changes in a plan that is supposed to be in its final form. If the West fails, it may be forced reluctantly to support some kind of sanctions against South Africa, possibly lifting landing rights for South African planes or boycotting agricultural products from the white-ruled country.

In addition, there potentially would be an escalation in SWAPO's guerrilla war with greater involvement of Soviet, East German and Cuban forces now asisting the movement.

White rancher Dirk Mudge, leader of the multiracial Democratic Turnhalle Alliance, Said his organization would consider taking part in another election under U.N. supervision, but it "all depends on whether an agreement can be reached on the conditions" under which such an election would be held.

Mudge said the Alliance wanted an internationally acceptable solution in Namibia, but not at the expense of "national suicide," meaning yielding power to SWAPO, which most whites regard in Namibia as a communist, terrorist organization.