Special Trade Representative Robert S. Strauss hined yesterday that the United States and Japan are close to an agreement on controversial questions relating to procurement by the huge Nippon Telephone and Telegraph Corp.

U.S. officials had accused the semi-government Japanese corporation of shutting our American and other foreign bidders seeking to export sophisticated electronic equipment.

At a meeting here earlier this month, President Carter and Japanese Prime Minister Masayoshi Ohira directed their subordinates to work out an understanding, with the hope of clearing away the problem before the Tokyo economic summit begins at the end of June.

In testimony yesterday before the Senate Foreign Relations subcommittee on international economic policy, Strauss told Sen. Jacob Javits (R-N.Y.) that "because we have been firm and stern, and because there was even greater militancy in Congress, we will come to an agreement. I assure you, it will be an agreement providing full reciprocity: It will work both ways or it won't work at all."

In earlier bargaining, Strauss had said that the U.S. would shut off Japanese access to $12 billion in government procurement contracts unless Japan included Nippon Telephone in the list of agencies covered by a new reciprocal code that is part of the mulitlateral trade negotiations.

There were no details yesterday on the form of the prospective Japanese-U.S. deal on the phone company. But if all goes well, American officials expect Strauss to reach an agreement during a visit to Tokyo in about 10 days.

Strauss, meanwhile, predicted that the MTN treaty will pass Congress "by an overwhelming margin. I know of no gins of opposition to it."

In related testimony before the subcommittee, Assistant Commerce Secretary Frank Weil said loner-term prospects for U.S. trade were grim. In the short run-through 1980-Weil predicted continued favorable trends, pointing to reduced trade deficits.

But he conceded that the latest oil-cartel price increases would add $4 billion to what the 1979 trade deficit otherwise would have been.

The pessimistic outlook for the period after 1980-the trade deficit easily could be $40 billion in 1990, Weil said-was traced to a combination of factors: slower world growht, intensified competition from rich and poor countries, higher energy costs and accelerating protectionist sentiment.

"Given these economic forces, just maintaining our market share, let alone expanding it, will be increasingly difficult during the next decade," Weil said.

As one way of improving the U.S. export potential, Strauss said "we should take a hard look at the anti-trust laws" to see whether an American version of the Japanese trading companies would not help smaller companies venture into the export business.

"We have to be bolder," Strauss said. "If we sit on our duffs for the rest of our lives, we'll only be where we are now, or worse."

The Japanese trading companies pool their resources in seeking business. As part of a trading company, a U.S. firm would have to risk less cash trying to break into the Japanese market, Strauss said.

Weil pointed out that many factors are involved in the heave U.S. trade deficit in addition to the usually cited higher cost of oil. He said there has been a "disturbing" loss of shares in the world market.