As President Carter flew off to Liberia on his way back to Washington yesterday, a top Nigerian diplomat put the United States on public notice that his government differs sharply with it not only on South Africa but also on the Cuban military presence in Africa.

Nigeria's ambassador to the United Nations, Leslie Harriman, said in an interview with the local press that so far as Nigeria is concerned "Cubans are welcome in Africa" provided they do not turn to subverting any sovereign black African government.

Defending Ethiopia, he said that Africa states had the right to invite Cubans in times of need just as President Mobutu Sese Seko had called on Morocco and Egypt for help last spring to crush rebels in Zaire's Shaba Province.

"Despite our traditional African hospitality, we should not lose the opportunity to be firm and get our feelings across to Mr. Carter," Harriman was quoted as saying in an interview the Daily Times, Nigeria's leading newspaper.

President Carter reportedly softpedaled the American view on Soviet and Cuban involvement in Africa during his talks with the Nigerian chief of state, Lt. Gen. Olusegun Obasanjo, and there was no reference to the issue in the final communique, apparently out of American deference to the Nigerian sensitivity on it.

Nevertheless, Obasanjo did respond indirectly to the president's concern in his remarks at a state dinner Sunday, saying he hoped Nigeria's mediating role in the Somali-Ethiopian dispute would succeed and thereby make both sides' appeal to outside military assistance unnecessary.

The obvious difference between Nigerian and American views over the growing Cuban presence in Africa highlighted a theme of Carter's three-day visit here - namely, the continuing existence of several contentious issues between the two countries despite a remarkable improvement in their overall relations this past year.

Altogether, Nigerians seems to be somewhat ambivalent in their attitude toward this much closer American-Nigerian relationship. On the one hand, they realize they are being drawn closer to the United States daily by their expanding economic ties and share with Americans many values, including a Nigerian inclination toward aggressive free enterprise, a love for democracy, and a spirit of extreme individualism.

On the other hand, they remain wary of U.S. political motives in southern Africa and are doubtful that Washington has any real intention of using its economic and political clout to bring any meaningful change in South Africa. Yet, for Nigerians, South Africa's system of apartheid, or strict racial segregation, has become practically in obsession since the outbreak of the student protest movement in Soweto in June 1976.

This Nigerian attitude of wariness toward the United States was amply expressed in local newspaper comment about the Carter trip and the general paly of the news. Most newspapers were surprisingly critical and questioning and gave Carter less space on their front pages and in their columns than the country's new austerity budget announced the night of his arrival.

None of them rushed to print the final communique, which American officials had to distribute to Nigerian reporters since their own government was not doing it. The headline in yesterday's Daily Times, a tabloid, was "Cars to Cost More: Many Other Goods Now Carry Heavy Duties."

Presumably the Times and other newspapers will start getting around to the communique and an overall evaluation of the Carter visit today, but clearly none of them is making any special effort for the historic occasion in both U.S.-Nigerian and U.S. African relations.

This seeming lack of excitement, bordering almost on indifference, reflects a deeper prevailing attitude here and there is nothing at all that special to trumpet about the fact American has finally, awakened to the fact that Nigeria is a regional superpower and should have been shown deference by Washington long before now.

Overall, the themes that emerged during the Carter visit are likely to persist and shape the direction of the new American-Nigerian relationship over the coming months and years. These include:

A common desire to increase cooperation in the areas of economic development and education with Nigeria looking to the United States for financing, private investment in key industrial and agricultural projects and places in American universities for thousands of Nigerian students.

A fairly close American-Nigerian entente in pushing current Western proposals for a peaceful resolution to the conflicts in Rhodesia and Namibia and Nigerian mediation in the Somali-Ethiopian dispute.

Should this Western approach not work out, however, here is a good chance of a serious falling out, particularly if Washington begins leaning toward acceptance of internal settlements in Rhodesia and Namibia.

Open and general disagreement over how to approach South Africa and specifically how to force chance in its apartheid policy. Nigeria wants immediate application of an economic boycott or other economic pressure by the West. The Carter administration feels this is most inopportune moment even to talk about this. Washington is presently seeking South African backing for Western peace plans for Rhodesia and Namibia.

Carter and Obasanjo agreed to disagree over this issue.

As Obasanjo put it at the signing of the Nigerian-American communique Sunday, they would proceed with "the two of us working together in areas we can work together and working separately in areas where we have to work separately."

A general unstated understanding that foreign power intervention in African conflicts is a bad thing but no specific Nigerian support for the American opposition to what one U.S. official called "the abnormal Cuban military presence in Africa."

Altogether there seem to be about as many good resons for a contentious future relationship between Nigeria and the United States as there are for an increasingly closer one. Indeed, it is not unlikely that Nigeria will develop a kind of love-hate complex toward America in the coming years.