A warning that both the United States and Western Europe have major adjustments to make if their respective bilateral links with Japan are to achieve a healthier balance came from Japanese Prime Minister Takeo Fukuda during a two-day visit to Common Market headquarters, which ended here yesterday.

"If inflation in the U.S. continues," warned Fukuda, less than 48 hours after meeting with President Carter at the Bonn economic summit July 16-17, then "the problem of America's bilateral trade deficit with Japan will also continue, despite my very best efforts" to correct it.

This Japanese warning was seen by European officials contacted here as meaning that high inflation is simultaneously eroding the international competitive stature of the U.S., weakening the American currency and thus causing the dollar costs of U.S. imports from Japan to spiral.

The Fukuda statement was given added drama, coming hours after the release in Tokyo of figures showing that in dollar terms, Japan's trade surplus with the U.S. rose by more than a 100 percent in less than a year - up to $5.3 billion for the first half of this year compared with $2.3 billion for the similar period in 1977.

Meanwhile, Europeans, whose deficit with Japan now appears to be stabilizing, also came in for some hard-hitting criticism from the Japanese leader in a speech here yesterday. In contrast to the "very deep and broad relationship between Japan and the U.S., which has developed in post-war years, "Europe has not quite treated us as a true friend or a real partner, but rather as something alien to them," Fukuda asserted.

"The days are past when Japan and Europe could be content with an indirect relationship through the United States as intermediary," he added.

This outspoken reproach levelled at negative European attitudes is apparently felt to be at least partly justified by European analysts here. Common Market officials said that there is a tendency in Europe to consider Japan as a kind of phenomenon which hopefully would "go away."

Fukuda's message to Europeans is a clear reminder that "Japan is here to stay," and that Europeans had better adjust to the increasingly strong reality of Japan's post-war resurgence, the officials stated.

Japan posted a near-record current account surplus in June of $2.33 billion, up sharply from about $739 million in May and $872 million for June 1977, the Japanese Ministry said in Tokyo. The trade surplus soared to $2.93 billion from $1.40 billion in May and $1.42 billion last year, according to The Associated Press.

[Unadjusted exports in June rose 21 percent from a year earlier to $7.95 billion, surpassing the May total of $7.63 billion. Imports, cut by a drop in oil imports, fell 2 percent from a year ago to $5.05 billion and were well below the May total of $6.25 billion.]

(The preliminary results for June bring the current account surplus for the January-June half-year period to a record $8.81 billion compared with $3.08 billion for the same period last year, AP said.