Japan has replaced the United States as South Africa's leading trading partner, moving into the gap left by American companies that have pulled out since sanctions were imposed a year ago.

Japan's new position as the number one country doing business with South Africa has embarrassed Japan's corporations and government, which are concerned it may create a backlash in the United States. It also has sparked a study by the U.S. government to determine whether Japan is taking "commercial advantage" of American sanctions.

In one manifestation of Japan's concern, its diplomats here have been attempting to find out if a report on the first year of sanctions, to be presented to the Senate Foreign Relations Committee today by Assistant Secretary of State Chester Crocker, refers to Japan's increased trade with South Africa. Diplomatic sources said the report does not mention Japan.

The sanctions law, which bans new investment in South Africa, requires the government to see if other countries are rushing to fill the void and to apply trade sanctions if they are. The State Department asked the Office of the U.S. Trade Representative to conduct the study.

"Japan is not being picked on," said a U.S. expert on South Africa. But given the extent of its trade with South Africa, he added, "you can hardly ignore Japan."

Japanese diplomats here were reluctant to release figures on trade with South Africa, saying they are unofficial and suggesting that an increase in dollar terms may be due to currency fluctuations.

Nonetheless, they acknowledged that Japan has moved ahead of the United States as South Africa's leading trading partner, largely as a result of sharp cutbacks in commercial ties between America and that racially segregated nation. In addition to the sanctions, a number of major U.S. companies -- including General Motors, IBM and Kodak -- have stopped doing business in South Africa.

Estimates based on trade figures for the first six months of 1987 place Japan's two-way trade with South Africa at about $3.1 billion this year, and the United States' at about $2.5 billion. Both countries' trade with South Africa is down from last year, when the United States did $3.63 billion worth of business with that country and Japan had slightly less commerce, $3.6 billion.

While the State Department is not singling out Japan for its South African trade, groups that want to isolate South Africa are threatening some form of action, including a possible boycott of Japanese products by U.S. blacks.

The Rev. Leon Sullivan specifically listed Japan as a possible target of an American consumer boycott when he announced last June that he was abandoning his support of a code of conduct for U.S. companies doing business in South Africa -- the Sullivan Principles -- in favor of complete economic isolation. At that time he urged Congress to impose "stringent penalties" on U.S. trading partners such as Japan that move into South Africa to pick up business.

"They are selling their goods and picking up the market," Sullivan said in a recent interview about Japanese business in South Africa. "They are doing big business with South Africa, and it's growing."

He criticized the Japanese government, which he said has never agreed to meet with him on the issue as European governments have, saying that Japan likes to act as if it is not in South Africa while continuing to do business there.

"They don't realize how vulnerable they are. The lanes are wide open to a significant boycott, particularly among blacks," who are major consumers of Japanese products, Sullivan said.

Japanese diplomats here say their companies are well aware of the possibility of a black consumer boycott, and are holding back their sales efforts in South Africa. "Companies don't want to tarnish their image in the United States by being named as a company trying to expand market share in South Africa. They have bigger business in the United States," said one such diplomat.

Japan maintains no diplomatic relations with the South African government, but does have a consulate there. The Japanese consul general in Johannesburg, Katsumi Sezaki, recently resigned as a member of the Nippon Club in that city because it was promoting Japanese trade.

"As a representative of the Japanese government," he was quoted as saying at the time, "I could not be associated with any organization that promotes trade with South Africa."

Japan has followed the lead of some European nations and the United States in imposing sanctions against South Africa, including banning direct investment. Government officials met with major Japanese industrial groups urging them to be prudent in business dealings with South Africa.

Japan has refused, however, to place an embargo on its purchases of South African coal, which as an energy-poor nation it considers vital to its economy. Last year, Japan bought 20 percent of South Africa's coal exports, worth $1.57 billion.

According to the Far East Economic Review, South Africa began selling corn to Japan last year after a three-year absence from the market. Although South Africa's corn sales remained small, they came at the expense of U.S. and Chinese exports.

Japanese companies have made major inroads in areas such as cars, computers, chemicals and electronics that were once dominated by American producers. Auto sales were up 62 percent last year, while auto parts sales more than doubled. The cars and parts are all sold through Japanese-owned companies.