THE VISIT here by Japan's Prime Minister Takeo Fukuda was a success, in the sense that relations between the two countries are at least not getting worse. But the central dilemma is still undented. Japan exports far more than it imports; the United States does the reverse. Each country's imbalance has become a menace to the prosperity of the other. Each government has plenty of high-minded advice for the other - mainly to do things that would be expensive and politically unattractive. Neither is in a mood to move very quickly.

The United States think Japan ought to speed up its economic growth, to broaden the market for American goods there. The Japanese suggest, in reply, that the United States ought to reduce its rate of inflation to keep the value of the dollar from dropping further. Americans, bristling, inquire whether Japan is not dumping steel and motorcycles and so forth here - that is, selling illegally at prices below those in Japan. The Japanese change the subject and observe, accurately, that the whole question of trade deficits would become much more manageable if the Americans only cut back their inordinant imports of foreign oil.

In this kind of fencing, it is Japan that is under the greater pressure to act. The United States - and most other industrial countries - have told Japan that its trade surplus is intolerably large and, if it persists, it will force the deficit countries to resort increasingly to protectionism. The torrent of attractive and well-designed Japanese goods pouring into American and European markets has become an election issue of some weight, in a time of high unemployment.

The rather bruising U.S. - Japanese negotiations at the end of last year succeeded in persuading Japan that it had to take those warnings seriously. But the warnings became louder over the winter, when, instead of dropping as forecast, the Japanese trade surplus kept rising. At length the Japanese government reluctantly began to discuss export limitations. That was the atmosphere in which Mr. Fukuda undertook his visit last week.

The principal result of the trip is series of pledges by Japan to restrain the volume of certain key goods exported to the United States. Steel shipments to this country are to be held 10 percent below last year's level. Exports of color television sets are to be 30 percent lower. Japanese automobile sales here are to be no higher than last year - although it's worth noting that last year's sales were up a startling 35 per cent over 1976.

Mr. Fukuda has set those ceilings at just about the volumes at which those exports seemed likely to run in the absence of ceilings. The coming year does not seem to promise any great expansion of trade. Formal trade quotas are pernicious, for they require the Japanese government and industry to collude in allocating foreign sales. That only increases the tendency to cartelization about which American companies legitimately complain. Mr. Fukuda's pledges, in contrast, are temporary and mainly constitute a guarantee that - unlike the past year - the coming year will bring no sudden unexpected surges in Japanese exports to this country.

Free and rising world trade serves the best interests of the both the United States and Japan. But there is a limit to the rate at which trade can increase without inflicting painful disruptions on nations' economies. If Japan were not to apply temporary restraints now on its exports to the United States, it would risk permanent restrictions before much longer. Given that choice, Mr. Fukuda has taken the wiser course.