U.N. special representative Martti Ahtisaari is to end his mission to the South African-administered territory, Namibia (Southwest Africa), amid a controversy here over the date for independence and the registration of voters.

Twenty-one members of the 50-man U.N. Transitional Assistance Group will remain here in anticipation of the possible arrival of a larger U.N. task force-a decision that observers here attribute to optimism that the next phase of the Western blueprint for a settlement may be implemented.

During his 16-day stay here, Ahtisaari and his group have held several meetings with the South African administrator general, Marthinus Steyn, and the Southwest Africa Peoples Organization. South Africa and the guerrilla group, the two main parties to the Namibian dispute, have been engaged in a low intensity guerrilla war since 1966.

The U.N. envoy also has held several meetings with other political groups such as the South African-backed Democratic Turnhalle Alliance, the Namibia National Front and Church representatives, and visited the northern areas bordering Angola last week.

Demonstrators supporting SHAPO and the Democratic Turnhalle Alliance have greeted him at many places throughout the territory during his visit.

There are also indications here that some of the five Western powers that devised the settlement plan-the United States, France, Canada, Britain and West Germany-have been sounding out the possibility of opening embassies in Windhoek, the capital.

Ahtisarri has warned at least three times in public statements here that a settlement can be achieved only "if all parties concerned adhere to the letter and spirit of the Western plan."

The underlying tension between SWAPO and the South African government on the eve of Ahtisaari's departure was illustrated yesterday by the flat refusal of the SWAPO to send representatives to a fairwell cocktail party Steyn held for Ahtisaari.

In a letter to the UN representative, confirming that seven SWAPO detainees have been released, the information and publicity secretary, Mokgadeni Tlhabanello said: "We cannot go a share a cup of tea with our jailors."

During Ahtisaari's visit, three SWAPO insurgents were killed. During the period, SWAPO guerillas reportedly have abducted 10 black civilians into Angola.

"To scrap the present registration procedure and to begin all over again would not be beneficial to the sound development of local politics and will amount to a negation of the clear statement of the people," Steyn said yesterday reiterating that South Africa regarded Dec. 31 as the date for independence.

Ahtisaaro has suggested that he might recommend the holding of a new registration of voters.

Observers here still believe that the incentives for South Africa and SWAPO to achieve a settlement and go along with the Western plan are too strong to ignore-in view of the fact that if SWAPO carried on its war for another 10 or 15 years, it would probably inherit only a ruined country. South Africa would face considerable international pressure if it unilaterally declared independence in a form that was not internationally acceptable.

"Let say simply that, on the surface, things appear less tense than we expected when we arrived," a U.N. representative said, "and that on the surface we leave the territory more optimistic than we expected.

Another major stumbling block, which Ahtisaari did not have a mandate to discuss during this visit, is the deep water Atlantic Ocean port of Walvis Bay, whose transfer South Africa is prepared to negotiate only after independence. SWAPO has said it does not "want to go down on our knees" to get the city.