Tanzania's continuing role in Ugandan affairs is becoming a potential source of embarassment to the government of President Julius Nyerere shortly before the annual summit meeting of the Organization of African Unity.

Tanzania still has 40,000 troops in Uganda and the recently ousted president of Uganda, Yusufu Lule, is in Tanzania, where a close aide says he and a private secretary have been detained for two weeks.

Robert Serumaga, minister of commerce in Lule's brief administration, said he has spoken to the former president by telephone and that Lule is kept under constant armed escort and is locked in each night in the west wing of the state house in the capital city of Dar es Salaam.

The reported detention of Lule has fueled civil disobedience by Uganda's majority Baganda tribe and contributed to a general deterioration of law and order in the capital, Kampala, where more than 70 unexplained murders have occured in the last month.

Serumaga charged that Lule is under daily pressure to sign documents supporting his successor, President Godfrey Binaisa. According to Tanzania, Lule is in Dar es Salaam for "consultations," and offical statements have described him as an honored guest

As a result of the questions surrounding Lule's status and Tanzania's continued presence in Uganda, delegations from Tanzania and Uganda arriving in Monorovia, Liberia, for the OAU summit face criticism from other African governments rather than congratulations on the overthrow last May of the unpopular dictatorship of Idi Amin.

The outgoing president of the OAU, Jaafar Nimeri of Sudan, said his country intends to raise at the summit "Tanzania's violation of the OAU charter by its flagrant invasion of Uganda."

Nimeri said that Tanzania's continued "intervention" in the internal affairs of another African country "is a matter that harms the principles and independence of that country." Nigeria, Zaire, Morocco and Egypt are among influential OAU members expected to support Sudan's criticisms.

In addition, Sudan is burdened with 100,000 Ugandan refugees.

Attempting to head off at least some censure and gather support, the Ugandan government sent emissaries last week to Mozambique, Zambia, Nigeria, Angola, Algeria, Egypt, the Gambia and Lesotho. The chosen emissaries were among the influential leftwing of the Ugandan National Consultative Council and included its chairman, Edward Rugumayo, and Dan Nabudere, minister of community development.

Tanzania today announced plans for the withdrawal of some of its 50,000 troops in Uganda. Although an exact figure was not announced, there appears to be little prospect of withdrawing the troops as fast as originally hoped because of the deteriorating security situation, not only in Kampala, but in many provincial towns and villages where unexplained killings take place nightly, according to lawyers in Uganda. This week these lawyers described the situation as worse than under Amin.

The Ugandan government has ordered all soldiers to carry identity cards and has forbidden the carrying of weapons after dark except by those on mixed police and Army patrols in Kampala.