In a move that appears to be another step toward setting up a friendly independent government in the territory of Namibia without U.N. supervision, South Africa announced today that it is giving legislative powers to the national assembly there.

The 50-member body was elected in December over the objections of the U.S. government and four of its Western allies, who said its formation was in violation of a Western-devised U.N. peace plan for the territory.

The U.N. plan aims to end the 12-year guerrilla war between South Africa, which administers the territory under a revoked League of Nations mandate, and the Soviet-armed nationalist movement, the Southwest Africa People's Organization (SWAPO).

South Africa has cooperated in negotiations to hammer out a U.N. peace plan that would lead the country to independence with international recognition acceptable to both Pretoria and SWAPO.

But at the same time, South Africa has taken steps in Namibia to install a government there on its own terms.

First South Africa ran a voter registration drive for Namibia's population of less than a million. Then it held the election for the assembly.

Now, it has given the assembly, which is dominated by a South African-sponsored coalition of political parties, legislative powers.

Before the December election Prime Minister Pieter Botha said that South Africa would retain the "final say" in what happened in Namibia. But today's announcement also indicates that Pretoria may be paving the way for the assignment of some executive role to the assembly.

Observers here believe South Africa will never announce it is unilaterally giving independence to Namibia for fear that this would bring swift retribution from the rest of the world in the form of sanctions.

Although an independent government in Namibia set up without U.N. approval is unlikely to get internatinal recognition, South Africa apparently calculates that time is on its side.

It is widely believed here that a conservative tide is growing in the West that will look upon South African moves with less hostility. Recent policy statements here appear to harbor the belief that the black-ruled countries that host the guerrilla movements in Namibia and Rhodesia will eventually tire of the war as their economic woes worsen.

The South African government is anxious for the party it favors in Namibia, the multiracial Democratic Turnhalle Alliance, to increase its popularity in comparison to SWAPO and this is seen as one of the reason for today's action. Alliance leaders have been frustrated in their attempts to repeal discriminatory legislation and thus gain support among the country's 800,000 blacks.

With legislative powers, the Alliance, which controls the assembly, can be expected to do away with racial discrimination in public places. Ending segregation in schools and neighborhoods may take much longer since whites still dominate the Alliance's leadership.