Secretary of State George P. Shultz today told representatives of key black African countries that the presence of Cuban troops in Angola is the main obstacle preventing South Africa from giving independence to Namibia.

U.S. officials said Shultz did not make an explicit link between withdrawal of the Cubans and an agreement on the future status of the Southwest Africa territory, which South Africa has controlled since the end of World War I.

But the officials acknowledged that the thrust of Shultz' message was to underscore that a breakthrough will be difficult unless South Africa's security concerns about the Cubans in neighboring Angola are alleviated.

State Department spokesman John Hughes, denying that a Namibia-Angola linkage was part of U.S. policy, said: "The United States doesn't have a position. The United States has an observation: one of the realities is the presence of Cuban troops in Angola."

A senior U.S. official said privately that the U.S. attitude remained unchanged from the position stated by Chester A. Crocker, assistant secretary for African affairs, in congressional testimony Feb. 15. Crocker said it was unrealistic to expect progress on Namibia as long as South Africa fears a communist presence on its borders.

However, Shultz today made a determined effort to reassure black Africans that the United States wants to help achieve an equitable resolution of the Namibia problem despite charges and perceptions in Africa and among American civil rights groups that the Reagan administration's policy is tilted toward South Africa.

His forum was a series of three meetings involving Sam Nujoma, head of the Southwest Africa People's Organization, a guerrilla organization operating from bases in Angola; and the foreign ministers of Angola, Botswana, Mozambique, Tanzania, Zambia, Zimbabwe, Nigeria and Zaire. All are here for a U.N. debate on Namibia.

Hughes, who described the meetings as "extremely cordial," said Shultz had said that all other issues in the Namibia dispute can be resolved if the "proper environment" can be created.

By that, Hughes added, Shultz was referring to "the connection between sovereignty and security in the region" and the fact that the presence of Cuban forces in Angola and South African forces in Namibia has caused frequent violence.