Prime Minister Robert Mugabe said today that independence for the South African-controlled territory of Namibia cannot be linked to withdrawal of Cuban troops from neighboring Angola.

The Reagan administration, which is negotiating with South Africa to try to break a stalemate over Namibia, has not made pullout of the 18,000 Cuban troops a precondition for a settlement, but it has indicated that progress in the talks would be difficult without such a move.

Mugabe spoke at a press conference after returning from a two-week tour of Asia that took him to China, Japan, India and Pakistan. He said he obtained pledges of aid, cooperation and trade on the tour.

On Namibia, he said he hopes the United States "will not drift" from the United Nations position. This calls for election of an assembly to draw up a consitution for an independent Namibia, which South Africa has ruled for more than 60 years as a trust territory.

"The South Africans are not in Namibia because the Cubans are in Angola," said Mugabe, who has become one of the key voices in African liberation diplomacy.

"If that is the logic, then we should give a logic lesson to the American administration," he added. "We cannot accept that the solution we are seeking for Namibia should depend on withdrawal of the Cubans from Angola. That is a different matter."

While still in Pakistan, however, Mugabe made a pronouncement that should have been pleasing to the Reagan administration. He strongly condemned the Soviet invasion of Afghanistan, calling it "utterly wrong" and comparing it with South Africa's intervention in southern Africa.

Comparing the Soviet Union to South Africa, which is ruled by a white minority, is about as harsh a criticism of Moscow as an African leader could make.

Mugabe was sharply critical of the defeated French president, Valery Giscard d'Estaing, saying that despite promises of changes in policy toward southern Africa nothing happened. He said he hopes France's new Socialist president, Francois Mitterrand, will transform French policy.