President Carter arrived here last night to become the First American leader ever to make an official state visit to black Africa.

He was greeted upon his arrival from Brazil at Murtala Muhammed international airport by Nigeria's chief of state, Lt Gen Olusegun Obasanjo and then driven immediately to State House on the marina of Lagos Island where he and other top officials of his party are to stay during their three-day visit.

Along the half-hour motorcade route, thousands of Nigerians lined the highway in the pre-midnight darkness, shouting "Hooray Carter" and waving signs reading "Welcome Carter."

Last night's arrival ceremonies were simple with a small Nigerian girl handing Carter a bouquet of flowers and the president leaning down to shake her hand.

Wearing a summer business suit, Carter walked down a red carpet accompanied by Obasanjo, who was in uniform and carrying a swagger stick.

The official welcoming ceremony will be held today at Dodan military barracks on nearly Ikoyi Island.

The only other American president to pass through black Africa was Franklin D. Roosevelt who landed at Roberts Field in Monrovia, Liberia, en route home from the Cairo Conference in 1943. He stayed only a few hours, however, and did not pay and official visit.

President Carter's coming to Nigeria marks in a dramatic way the attempt by his administration to forge a whole new relationship between the United States and black Africa, based in large part on establishing close ties with Nigeria, the continent's richest and by far most populous nation. He is scheduled to make a major speech this a afternoon on the United States' "new spirit of involvement" in Africa.

He will also discuss a broad range of bilateral and international issues with the Nigerian chief of state. These reportedly include the price of Nigerian oi, the declining value of the dollar, an improved climate for American investment here, increased U.S. financing for development projects and the situations in both southern Africa and the Horn of Africa.

In addition, the Nigerians are understood to want to discuss an oil agreement with the United States fixing the price and quantity for a number of years so that Nigeria can be assured of its income.

Also of increasing public concern to Nigerians is whether the Carter administration intends to make good on its promises of a new policy toward the white-ruled states of southern Africa and specifically its commitment to bring about black majority rule by the end of this year in Rhodesia and in Namibia ruled by South Africa as the territory of Southwest Africa despite U.N. demands for its independence.

Primarily responsible for charting this new course in American foreign policy toward black Africa, and for ending a decade of hostility between Nigeria and the United States, has been America's ambassador to the United Nations, Andrew Young. He is among the honored guests staying at State House with the president and his wife, Rosalynn, Secretary of State Cyrus Vance, and the president's chief national security adviser, Zbigniew Brzezinski.

The Lagos visit would provide Carter and his aides with the opportunity for meeting with several key African figures - including Joshua Nkomo, one of the leaders of the Rhodesian guerrilla forces - to discuss the Rhodesian situation.

Young told reporters last night that Nkomo and Robert Mugabe, the other key Rhodesian guerrilla leader, have been invited to Nigeria and that Nkomo already has arrived.

Other African figures invited here are the foreign ministers of Zambia and Botswana and a senior Tanzanian diplomat. The three countries are in confrontation with Rhodesia.

Young said the African figures will meet with Vance Sunday. It was not clear whether a meeting with Carter was planned.

"Politically and economically, I figured Nigeria was the key to our Africa policy," said Young in an interview shortly before the president's arrival. "We want to establish a bridge of trust with Nigeria," he said in explaining one of the main objectives of the Carter visit.

Young argues that the new American policy is toward Africa is anchored in "economic realities." Nigeria, he pointed out, is fast catching up to South Africa as the country where American business has its largest investment on the continent. The U.S. embassy here estimates the amount presently at $1.2 billion compared to about $1.7 billion in South Africa.

Perhaps even more significantly, Nigeria has become the second most important source of foreign oil for the United States after Saudi Arabia, currently shipping more than one-half or its total daily production of 1.7 million barrels to American markets.

Nigeria has also become under the Carter administration one of the lynchpins of American diplomacy in southern Africa, with Gen. Obasanjo a strong supporter of the Anglo-American proposals for a peaceful resolution of the Rhodesia dispute and also backing the five Western powers in their bid to bring about a peaceful transition to black majority rule in Namibia.

The Nigerian leader played an important role last fall, together with Tanzanian President Julius Nyerere, in lining up th five frontline African states behind the Anglo-American peace plan for Rhodesia and then in getting the nationalist, guerrillas to accept it.

There are some signs, however, that Nigerians are beginning to question both the sincerity of British and American policy in southern Africa as well as the implications for their country of too close a political and economic relationship with the United States.

Nigeria's leading newspaper, the Daily Times, warned yesterday that President Carter would find Nigerian leaders "impatient and uncompromising" on issues affecting Africa. They will want to know, it said, "what specific plans President Carter has to end the juggernaut of racial oppression in Zambabwe [Rhodesia], Namibia and South Africa. They will find it difficult to accept the gradualist approach of the Western world to the resolution of the problems of southern Africa.

The newspaper demanded an end to what it called the "two faced position" of the United States in officially deploring South Africa's system of aparthid, or strict racial segregation, while private American business continued to be allowed to invest there.

Other newspapers were far more openly hostile. The respected New Nigerian said yesterday that Nigerians were "understandably unethusiatic" just as they were "wary" of the new friendship being struk up between Nigeria's rulers and the Carter administration.

Despite the unease here about Nigeria's political rapproachment with the United States, the improvement in ties between the countries over the past year has been remarkable.

In fact, Washington appears to have overcome the hostility felt by Nigeria toward the United States stemming from the 1967-70 civil war in the eastern part of the country. Americans were generally regarded here as backers of the abortive secessionist movement by the Ibo people though the U.S. government remained officially neutral.

This legacy of bitterness poisoned Nigerian-American relations for years.

Two years ago, Nigeria three times refused to allow Secretary of State Henry Kissinger even to enter the country to discuss his proposals for settlement of the Rhodesia tangel. Earlier, in February 1975, Gen. Obasanjo had personally led a detachment of Nigerian troops and tanks in ousting the U.S. agency for International Development from its building on Lagos Island.

One of the chief reasons for the continuing Nigerian antagonism toward Washington was the Nixon-Ford administrations' policy of tilting toward the white-ruled countries of southern Africa at what Nigerians viewed as the expense of the black people there.

All this began to change in February of last year when Ambassador Young visited Lagos and held "reconciliation talks" with Gen. Obasanjo, convincing him of the sincerity of the Carter administration in its intention to forge a new Africa policy tilted instead toward black Afirca. The Young mission was a total success and led to a state visit by the Nigerian chief of state to the United States last October.

The outcome of Gen. Obasanjo's visit, according to U.S. diplomatic sources here, was the beginning of a close personal relationship between him and President Carter. This has now become one of the foundation stones of the new American-Nigerian entente.

Despite the ups and downs in relations, a multitude of ties has been steadily spun over the years between the two countries. There are now more 15,000, Nigerian students attending American universities, and there is a plan afoot to send thousands more for vocational training.

Nigeria is also looking to American universities to recruit hundreds of professors to staff its 13 universities, seven of which are new ones.