Marking a thaw in relations between the United States and one of Africa's most important nations, President Carter welcomed Nigeria's head of State, Lt. Gen. Olusegun Obasanjo, to the White House yesterday.

After a long private meeting, the two leaders agreed that failure to achieve a peaceful transition to black rule in Rhodesia "would lead inevitably to steadily increasing bloodshed."

Obasanjo is the first Nigerian ruler to come to this country on a state visit. It signals a major diplomatic reconciliation between the United States and Africa's most populous nation.

Nigeria, also the richest of the black African countries, is the United States' second-largest supplier of oil. Of the 2 million barrels that it produces each day, the United States imports 55 to 60 per cent. (Saudi Arabia is this country's largest oil supplier.)

Relations between Nigeria and the United States have been cool since the early days of the Nixon administration. Last year Obasanjo's government rejected repeated efforts by then secretary of State Henry A. Kissinger to visit Lagos, the Nigerian capital.

Nigerian Ambassador Obujimi Jolaoso said last week that his government had noted a change in U.S. policy toward Africa from that of previous administrations, and that U.S. Ambassador to the United Nations Andrew Young's visits to Lagos earlier this year had helped improve relations between the two countries.

Yesterday, in welcoming Obasanjo as "a courageous fighter for liberty and independence," Carter stressed the fact that when he goes to Nigeria in about six weeks he will become the first U.S. President to visit a black nation of Africa.

After a meeting that lasted two hours and 15 minutes, more than a hour longer than scheduled, White House press secretary Jody Powell said the two leaders had spent most of their time discussing the "problem of a peaceful negotiated settlement in Zimbabwe." Powell used the African name for the troubled Rhodesian nation of 268,000 whites and 6.3 million blacks.

Powell said Carter and Obasanjo agreed that "progress was being made" on a British-U.S. plan that calls on Rhodesian Prime Minister Ian Smith to hand over power peacefully to Britain, which formerly ruled Rhodesia, and it provides for a transition under British and United Nations auspices to black majority rule by the end of 1978.

Powell said Nigeria has indicated its support for the plan as a "framework for negotiations."

He added that Carter and Obasanjo agreed "that failure to reach a negotiated settlement within the framework of the U.K.-U.S. proposal would lead inevitably to steadily increasing bloodshed and that such a deterioration would be detrimental to the interests of the United States, Nigeria, and especially to the people of Zimbabwe, both black and white."

The leaders also discussed the war between Ethoipia and Somalia over the Ogaden Desert and Ethiopia's 16 year war with Eriterean secessionists in the nothern part of the country.

Powell said Carter and Obasanjo expressed hope for an "early end to the fighting" and that Carter voiced support "for an African solution to these problems." That was interpreted as a pointed reference to the fact that the Soviet Union is increasingly involved in Ethiopia and still has military ties with Somalia.

Obasanjo also met with Secretary of State Cyrus R. Vance, received the keys to the city form Mayor Walter Washington and attended a working dinner at the White House hosted by President Carter.

Today the Nigerian leader is scheduled to have breakfast with the Congressional Black Caucus, meet again with Carter, have lunch with the Senate Foreign Relations Committee and speak at Howard University.

In today's meetings, Obasanjo, who came to power after the Feb. 13, 1976, assassination of his predecessor, Gen. Murtala Muhammed, is expected to urge increased U.S. participation in Nigeria's five-year development program.

The U.S. government does not send aid grants or loans to Nigeria, but the Nigerian government is paying for a program sponsored by the Agency for International development to provide technical training for 500 young Nigerians in American colleges. Nigeria is seeking heavy U.S. business investment in road, housing, and industrial projects.