Cuban President Fidel Castro and Ethiopian leader Mengistu Haile Mariam engaged in an unusual public coloquy at a Havana rally Wednesday night over the Cuban military role in Afria.

Outwardly, Mengistu, a lieutenant colonel who is chairman of the Marxist Ethiopian Provisional Military Administrative Council, was paying tribute to Cuba's combat support in driving Somali invaders from Ethiopia's Ogaden region last month. Castro was basking in the praise.

But Cstro and Mengistu were also virtually debating, between the lines of their public remarks, whether Cuban troops should be drawn into the remaining and older war in Ethiopia against the secessionist province of Eritrea. This is one of the most difficult choices Cuba has faced in the projection of its military power into Africa, in coordination with the Soviet Union.

Diplomatic strategists in Washington and other capitals yesterday were amining monitored broadcasts of public remarks by Castro and Mengistu for clues to the private discussion underlying their speeches before an estimated million people in Havana's Plaza de la Revolucion.

A Carter administration official concluded yesterday, "Mengistu is trying to get his hooks in a little deeper. But Castro is standing pat."

Mengistu ended his week-long visit to Cuba yesterday without indicating whether he had obtained Cuba's agreement use its American estimated 17,000 military personnel in Ethiopia for the Eritrean conflict. As far as is known, Cuba until now has permitted only some military advisers, and reportedly a few of its pilots, to join in the gangled Eritrean conflict, State Department sources said yesterday.

State Department press spokesman Hodding Carter III said "we do not know" the extent of Cuban military involvement in Eritrea "beyond some indications that Cuban pilots have flown combat missions in Eritrea." On Wednesday an Eritrea "beyond some indications that Cuban pilots have flown combat missions in Eritrean Liberation Front broadcast claimed that Cubans were playing a "major role" in carrying out bombing sorties against "liberated" zones of Eritrea.

Ethiopia is believed to be attempting to mount its major seasonal offensive against the Eritrean secessionists. It would use greater power than in past failures, employing some of the estimated billion dollars of Soviet military equipment it has received in the past year, plus Soviet Cuban military advice and Cuban troops - if it can get them.

In the judgment of American analysts, Castro laid out at Wednesday night's Havana rally, a rationale "that could permit him to go either way - leaving his options open." Until recently, Cuba, which is in the awkward position of having trained some of the Eriteam liberation forces, described Eritrea as an internal Ethiopian problem.

Following the defeat of the agressors against the Ogaden," Castro said in introducing Mengistu, "imperialism and its reactionary allies madly demand the immediate withdrawal of Cuban combatants in Ethiopia."

"Anyone can understand," he said, "that this also means the immediate initiation of new acts of agression. We, as a matter of Principle, emphatically refuse to discuss with the United States this point or any other point concerning Cuba's solidarity with the just struggles of the peoples of Africa."

"Yankee imperialism," he said, "questions the right of Ethiopia to defend its territorial integrity and its unity against Eritrean secessionists." But "the United States," Castro continued, "itself had a bitter historic experience with secessionism" and "a very pacifist man, noble and of high stature, Lincoln, was forced to resort to arms to prevent it."

Castro, however, stopped short of saying what Cuba would do, except to say "our combatants will not remain with arms folded if there is a new invasion of Ethiopia.

The Eritrean conflict, very unlike the Ogaden war, is hardly an "invasion." But Mengistu in his remarks, appeared to try to square that circle, expressing confidence "that the Cuban masses will be alongside us" in the struggle.

He charged that "imperialism, the reactionary Arab classes, and the fifth columnists conspire to thwart our revolution, supporting, in the administrative region of Eritrea, the traitors who are currently plotting to sell their fatherland for petrodollars."

"All the NATO countries which have been defeated in eastern Ethiopia (the Ogaden)," Mengistu claimed, are now "trying to get in the north (Eritrea) what they failed miserably to achieve in the east."