Andrew Young, President Carter's Africa troubleshooter here on a recent fence mending mission, was surprised when Lt. Gen. Olusegun Obasanjo, Nigeria's head of state, asked how to attract more American investment.

His surprise was not just based on militant Nigeria's energetic use of the United States as a favorite whipping boy. Rather it reflected astonishment at the general's seemingly sincere incomprehension of the factors discouraging foreign investment.

On face value, the general had a point. His country is the world's seventh largest producer of crude oil (worth just under $9 billion last year), has a population of 75 million, and expects its gross national product, now at the $27 billion mark, to outstrip arch enemy South Africa's within a year. And Nigeria needs everything from roads and telephone to trucks, hospitals and industrial plants.

But what few Nigerians want to grasp is that doing business in Nigeria is as hard as anywhere in the world. The rewards are commensurate with some firms ripping off the locals (and copying their norms) with up to 300 per cent profits.

In common with other suddenly wealthy oil producers, Nigeria has its share of port congestion - although much improved over the past year - as well as inadequate infrastructure and shortages of trained manpower.

But Lagos, Africa's fastest growing city, is unique for horrendous traffic, capricious telephone service, regular power breakdowns and rent gouging landlords. A modest three-bedroom home - out of the open sewer, unpaved road, shantytowns that house more than 90 per cent of Lagosians - goes for $40,000 a year. And payable five years in advance, thank you.

First-year start up costs for a one-man, one-secretary operation are estimated in the $250,000 range.

Then there is the no small matter of obtaining visas for foreign technicians and businessmen. Theoretically, Nigeria is trying to ease up its restrictions on foreigners here for specific, short-term projects while tightening the screws on long-term foreign residents whose jobs can be "indigenised," og use the local word for putting Nigerians in power jobs.

Many American companies are put off by other aspects of "indigenisation," which by 1979 wiull have given Nigerians majority control of all local industry and at least a 40 per cent share - and often 60 to 100 per cent - in other businesses. Citibank withdrew from one of its most prosperous operations rather than set a precedent for government majority control for its other worldwide, ventures. And the oil companies, by far the largest foreign investors, are have been at loggerheads with the government over profit margins for the past two years.

For the aircraft, vehicle and telecommunications makers who are among the more recent American investors, there is that peculiarly West African institution knows as "dash" to deal with. 'Dash" is a bribe and in Nigeria "dash" comes only in king size, a source of moral quandary and potential public embarrassment for American firms in these post-Lockheed days.

Even without "dash", the cost of surviving here is multiplied by galloping inflation - 40 per cent on an annual basis - fueled by excessive increases in money supply and government and private spending.

Thanks in part of the agreesive salesmanship in the commercial end of the U.S. Embassy, American sales have doubled since 1974, topping $700 million last year. Big American construction firms have finally wangled contracts. Yet, the United States, which buys half of Nigeria's oil and is by far and away its biggest partner for exports, ranks only after Britain and West Germany as a source of its imports.

On the social front, the military authorities in power since 1966 have sat hard on the trade unions. But the risk calculators have to worry about a society where one per cent of the people is calculated to control 75 per cent of the country's wealth.

Even under "indigenisation", it's the Nigerian fat cats, not the workers, who stand to benefit most from provisions requiring the sale of shares to employees.

Trained manpower - except for the thin crust of university-educated Nigerians - is hard to come by. And those who are trained more often than not are not given positions of responsibility in their fields in a society still reluctant to delegate authority.