President Carter and Japanese Prime Minister Masayoshi Ohira yesterday reached a long-term agreement designed to defuse the chronic economic tensions between the two countries.

At the same time, the two leaders ordered their subordinates to settle "in acceptable fashion" an outstanding dispute over procurement by the giant Nippon Telephone and Telegraph Co. before the heads of state in Tokyo takes place late in June.

Privately, American officials said that this dispute, which had escalated into a symbol of Japanese protectionism, was almost certain to be cleared up, but probably not until after Ohira's visit ends Sunday.

The basic formula of the economic agreement-part of a longer communique on security, energy, and other international issues-is this: Japan, for its part, agrees that it will open its markets wider to imports, especially manufactured goods, to reduce surpluses in its balance of trade and its current account (service plus trade). It acknowledges that these surpluses are "not appropriate in existing international circumstances.

The United States, in exchange, will not only attempt to reduce its international deficits by better control of inflation, but also recognizes that "the accomplishment of these goals will require several years."

A high Carter administration official said that, "What's needed is to get off each others' backs and proceed [to manage] broad policies." Protectionist sentiment will be reduced, he added "if we can stick to that."

At a White House briefing, special ambassador Henry Owen conceded that much of the language involving Japanese pledges to "promote a continued reduction in its current account surplus," and the American pledges on inflation control and energy-use restraint duplicate an understanding signed in Tokyo by ambassador Robert Strauss and Nobuhiko Ushiba in January 1978.

"But this is the first time that the heads of state of the two countries, face to face, have made this commitments," Owens said. "It's one thing for Cabinet ministers to talk about these things. It's another for heads of government to commit themselves to these policies," he said.

While Carter and Ohira weremeeting at the White House, Strauss met with Hisashi Owade, deputy director general of the economic bureau of Japan, to discuss the NT&T and a few otherspecific trade issues.

Strauss also talked to Ohira about the problem at one of the White House sessions. Another opportunity to deal with these specific tradematters may arise at a breakfast at Blair House to be hosted by Ohira for U.S. Economic Officials this morning.

Carter and Ohira exchanged exceptionally warm greetings at opening ceremonies on the south lawn yesterday morning. Carter said that the "close relationship" between the two countries had enhanced the security of both. Nevertheless, the two leaders said frankly that significant econimic problems hadcropped up, but pledged to solve them.

During both a morning and afternoon session, according to a high official present, Carter was "powerfully impressed by Ohria. He's the sort of fellow who deals clearly and with specificity on the issues. There was no bull the whole time-they just went from one issue to another, and disposed of them."

Japanese government sources said Ohira was happy about the way things had gone, and was especially pleased by the propsect that day-to-day problems would not be allowed to escalate to headline proportions.

Two U.S.-Japanese groups will be assigned to create and monitor the broader framework for the longer term economic discussions to which Carter and Ohira agreed. one is an existing joint sub-cabinet group to keep track of developments over the next several months.

The other will be a newly appointed committee of "Wise men," drawn from the private sector, to advise the president and prime minister on longer run solutions to problems.

Carter and Ohira consciously avoided a timetable for bringing two nations' internatinnal accounts into better balance. Japan's trade surplus with the United States last year was close to$13 billion, and is expected to be sharply lower this year. In response to a Question, Owen said that the recent depreciation of the yen, after a long rise, could "portend a rise in their surplus, and overshadow a lot of other issues."

On other problems, the commnique was a restatement of well-known U.S.-Japanese relationships or positions, with emphasis that cooperation between the two countries had 'become close then ever...and will deepen in the 1980s."

Ohira is to address the national press club today, and reportedly give some details of his plans to expand Japanese imports. He then will visit key members of the house and senate whohave been most interested in U.S.-Japanese trade questions. CAPTION: Picture, Prime Minister Ohira and President Carter, right, join in making formal remarks at the White House after Japanese official arrived at executive mansion. By Frank Johnston-The Washington Post