Prime Minister Masayoshi Ohira implied today that future Japanese foreign aid to Vietnam would depend on whether the Vietnamese government permits the establishment of permanent Soviet military bases there.

He said that if the Soviet Union permanently bases ships at Cam Ranh Bay in Vietnam. Japan would have to carefully consider whether to offer Hanoi full-scale economic aid.

Howeer, he said Japan does not yet know whether Soviet ships are merely docking temporarily for supplies or are going to be based there permanently.

Ohira's remarks in an interview with three American reporters were the strongest public hint so far that Japan might use future foreign aid as a lever to discourage a Vietnam Soviet military partnership.

The government has expressed strong concern in recent days about both Soviet military planes and ships being stationed in Vietnam, regarding them as potential threats to Japan's supplies of oil being brough from the Middle East. They also regard the possibility of permanent Soviet bases there as a major new buildup of Russian strength threatening the stability of Asia generally.

Two Soviet reconnaissance planes have been spotted recently at the air base at Da Nang and several Soviet ships have been seen entering and leaving Cam Ranh Bay. The Soviet use of Vietnamese airfields and ports for military purposes began during the recent war between China and Vietnam but has also continued since those hostilities ceased.

The idea of pressuring Vietnam to reject permanent bases has surfaced gradually in the Japanese press. Last week, according to one account today from an unidentified Foreign Ministry source, Japan warned the Vietnamese ambassador that it would stop extending economic aid if Vietnam becomes a permanent military base for the Soviets.

In the interview today, Ohira carefully emphasized that there would be no withdrawal of Japan's current aid programs, which consists of about $64 million annually in grants and loans.

I don't think . . . we contemplate anything like using this as leverage or withdrawing it . . . to influence our Vietnam position," the prime minister said.

But he said Japan is now in a second stage of considering larger economic aid programs for Vietnam.

"If the Soviets attain permanent bases there," he said, "we would have to carefully and seriously consider what to do about any full-scale economic aid, although we would have to complete disbursing whatever we have committed already. . ."

The result, he suggested, will depend on what actually happens in Vietnam.

"Much depends on the . . . nature of Vietnamese behaviour. We must carefully observe this. I think it's much too early to pass any judgment. I don't think Japan's Vietnam policy has met any decisive test. So let me say we are watching the Vietnamese behaviour and secondly we are carefully considering the wisdom of second-istage aid."

In answer to other questions, Ohira took a relaxed view of the economic friction between Japan and the United States, issues which will be central to his discussion in Washington early next month with President Carter.

He acknowledged complaints about Japan's large surplus, but said his country has been "moving very rapidly toward normalization," especially last fall. He declined to be specific about any new offers Japan might make to trim the trade balance.

Ohira said Japan's tariff schedules compare favorably to those of other countries. There are problems with non-tariff barriers that restrict access to the Japanese market, he acknowledged, but suggested they were no stiffer than in other countries.

"This kind of barrier exists in every country and I don't think Japan is a particularly bad boy," Ohira said.