Cuba is prepared to cooperate with an American-sponsored peace effort aimed at getting all Cuban troops out of Angola in return for withdrawal of South African troops from Namibia and independence for that disputed territory, Cuban President Fidel Castro has said.

Castro also said in an interview here last week that Cuba's troop strength in Ethiopia has fallen to a "symbolic" level. He declined to give figures, although U.S. officials have put the current number at 5,000, down from an initial 17,000 in 1977.

In his first full account of the Cuban reaction to a series of diplomatic developments in southern Africa in recent months, Castro endorsed the U.S. mediation effort there as having the potential to "exercise a positive influence in the international sphere" and improve relations between Washington and Havana if it is successful.

While hinting at a substantial lowering of Cuban military ambitions in Africa, Castro also warned that his units would stay in Angola "5, 10, 15 years" or longer if the regional peace settlement sought by the United States is not achieved.

But behind the strong assertions by Castro and other officials of Cuba's commitment to staying in Angola as long as needed, there are emerging signs here of a lessening of public enthusiasm for the nine-year-old war effort in which an estimated 2,000 to 3,000 Cuban soldiers have died.

Castro declined to give any casualty figures, saying only that 200,000 Cuban soldiers and civilians have served in Angola, where an estimated force of 25,000 to 30,000 Cuban troops has been supporting the Marxist government against a series of South African invasions and the guerrilla forces led by Angolan rebel Jonas Savimbi, which are allied to South Africa.

One of Cuba's most popular folk songs today carries veiled allusions to a war weariness with Angola, according to Havana residents who report that, in contrast to earlier years, they are now aware of growing numbers of Cuban soldiers refusing to serve in Angola. Cuban forces in Angola reportedly are volunteers, mostly drawn from reserve units.

After three years of conversations with the Reagan administration and the South African government, Angola announced in November the conditions it had put to South Africa for a settlement. They included implementation of U.N. Security Council Resolution 435, which calls for independence for Namibia, a complete South African military withdrawal from that territory and a halt to logistical aid to Savimbi's UNITA guerrilla group.

In return, Angola said it would agree to a phased withdrawal of 20,000 Cuban soldiers from southern Angola over a period of three years. A residual Cuban force, the size of which is not disclosed in the published Angolan proposal, would remain, for an indefinite period, north of the 13th Parallel around the capital city of Luanda and in the oil-producing exclave of Cabinda, which is separated from the rest of Angola by a strip of Zaire.

South Africa swiftly accepted the principles of withdrawal outlined by the Angolans but rejected the procedures. Frank G. Wisner, deputy assistant secretary of state for African affairs, has engaged both governments in a new round of discussions in recent weeks in an effort to break the deadlock.

In his remarks to three Washington Post editors, Castro provided some new details of the proposals as understood by the Cubans.

He indicated that the Cuban force that would remain behind would number up to 10,000 soldiers and would be garrisoned around airports, communication points, the capital and Cabinda, where Gulf Oil produces 155,000 barrels of oil a day.

"Cabinda is vital for the Angolan economy. Gulf Oil works there, and I think they are satisfied, they have been well defended. Clearly we don't do it to defend the interests of Gulf. We are defending the interests of Angola, and the oil suits both Angola and Gulf. Our forces there are not part of those covered in the negotiations taking place," Castro said.

"If an agreement is reached, we will comply rigorously to the part which involves us," he continued, speaking of the Namibia negotiations. "It is the Angolans who have to decide." Castro said it would take the Angolans three years "to replace our troops with their troops. . . . Our troops in the south approach a figure of 20,000 men and constitute the bulk of the Cuban forces" in Angola.

Withdrawal of the residual force in the north "could be discussed and agreed upon between the Cubans and Angolans in conformance with Angola's security needs," he said.

Explaining his willingness to consider cooperation with the U.S. diplomatic effort, Castro said, "I believe that the United States is interested in its relations with black Africa and really doesn't want to appear tied to the policy of apartheid. I believe the United States also has an obsessive desire for the withdrawal of Cuban troops from Angola. For the United States, a small country like Cuba having some troops in some places seems to be a violation of tradition, of the norms."

But he seemed to indicate that other African states may have misgivings about the negotiations. Citing public declarations by neighboring African states criticizing the U.S. effort, Castro said, "The frontline states, black Africa in general, is not pleased about the idea of a Cuban troop withdrwal. They feel very threatened by South Africa. . . . The only outside forces that have supported them have been the Cuban forces, and they feel that when these forces are withdrawn, they could be at the mercy of South Africa."

Castro drew a contrast between Angola and Ethiopia, where up to 17,000 Cuban troops arrived in 1977 to help repel an invasion from Somalia.

"In Ethiopia, our force is very small, composed of well-armed units, with a good fire potential," he said. "Our presence there now is more symbolic at the side of the Ethiopian force; it is not the same as Angola."