Japanese Prime Minister Yasuhiro Nakasone, ending two days of meetings with President Reagan, said yesterday that Japan's towering trade imbalance with the United States should begin to decline this fall.

Nakasone made the statement at a news conference immediately following a Rose Garden sendoff at which he pledged to undertake a sweeping restructuring of the Japanese economy and to work steadily toward reducing the trade imbalance as a "national policy goal."

Reagan, calling the U.S.-Japan relationship "strong and vital," praised Nakasone's economic commitments. Reagan said that the trade imbalance, which soared to $49.7 billion last year, "results from complex factors that will take time, vigorous effort and patience to correct."

Nakasone's two-day visit, which included an intimate luncheon and meeting with Reagan at Camp David Sunday and a brief meeting with him at the White House yesterday morning, was notable for the relatively relaxed atmosphere on both sides about the persistent trade problem and other issues.

Nakasone did not provide details of how he will accomplish the realignment of the Japanese economy from its longtime export orientation to much greater reliance on domestic demand. He told Reagan and others only that he is establishing a governmental headquarters to coordinate detailed planning among government agencies and private groups.

During Nakasone's stay, U.S. and Japanese officials did not reach the agreement that had been hoped for on items to be included in the next round of market-opening discussions. A Japanese official said government agencies in Tokyo were unable to agree on this in time for announcement while Nakasone was here.

Two hours after the White House meetings, Nakasone was reminded by 20 members of Congress at a luncheon meeting of the political sensitivity of trade issues.

Senate Majority Leader Robert J. Dole (R-Kan.), speaking on behalf of the lawmakers, told Nakasone that trade remains "a volatile issue" that inevitably will be fought out in this fall's elections.

"We hope to see the impact of Japanese actions" in the trade field in the coming months, Dole was quoted by Japanese officials as saying.

Rep. Sam M. Gibbons (D-Fla.), chairman of the House Ways and Means trade subcommittee, said that many of the lawmakers at the luncheon, including himself, made pleas for Japanese importation of products and commodities from their home areas. In the long run, Gibbons said, "the Japanese are headed in the right direction" by agreeing to expand domestic consumption.

"This is the only thing that is going to work, but it will take a long time to get politically positive results," he added.

Nakasone, in forecasting an early turnaround in the trade imbalance -- which has tripled in the 3 1/2 years since he took office in November 1982 -- cited tariff cuts on 2,000 items and other progress in opening Japanese markets to imported goods, especially machinery and other manufactured products from the United States, recent changes in the yen-dollar exchange rate and stimulation of the Japanese economy.

He told a news conference that Japanese exports have leveled off if measured in volume of goods and have declined in value if measured in yen. In dollar terms, however, they are continuing to rise temporarily because of the strengthening of the yen.

"If we maintain this trend and also further expand domestic demand in Japan, then the trade relations between our two countries will begin to change conspicuously. And I myself expect that sometime around this coming fall this trend will become tangible," he said.

Japanese officials said official data suggested that Nakasone's forecast of a discernible and established trend of reduction instead of increase in the trade imbalance was realistic.

The timetable of an autumn turnaround has political significance for Nakasone. His term as president of the ruling Liberal Democratic Party -- and thus as prime minister -- is due to end in October. It would require a change in party rules, which is difficult to arrange, for Nakasone to extend or renew his term.

Nakasone left for Tokyo yesterday afternoon.