TOKYO, OCT. 29 -- The dollar closed in Tokyo at a record low here today despite intervention by the Bank of Japan to stem the slide.

Analysts said the day-long selloff of the U.S. currency was sparked by anxieties over the future course of the foreign exchange and stock markets. The dollar opened at 138.60 yen to the dollar, down about 2 yen from Wednesday's closing, and then plunged further, ending the day at 137.55 yen, a postwar low.

The previous closing low occurred April 27, when a dollar could be bought in Tokyo for 138.70 yen. On that day, the dollar fell briefly to 137.25 before the close. The Bank of Japan made an unsuccessful effort to arrest the dollar's slide by buying an estimated $800 million of the U.S. currency. Financial officials said today that the bank will continue to intervene at whatever cost in an effort to stabilize the dollar.

"Our position is if you want to sell {dollars}, we are going to buy," said Japanese Finance Minister Kiichi Miyazawa. He added, "If the foreign exchanges are calm and stable, then the stocks will be calm and stable."

He said that intervention by central banks in New York, London and Tokyo over the last two days has been "very big."

Miyazawa also said that an agreement by President Reagan and Congress in the current deficit-reduction talks would soothe much of the anxiety that is causing the current crisis in the stock and foreign exchange markets. Such an agreement "would have a direct effect on the market," he said.

Miyazawa, Prime Minister Yasuhiro Nakasone and Bank of Japan governor Satoshi Sumita all said yesterday that consultation among the seven western economic powers (the Group of Seven) was working well. They said that they did not think a G-7 meeting was called for now. Nakasone suggested that such a meeting should await the outcome of U.S. budget negotiations.

Meanwhile, business leaders here called on the government to do whatever necessary to stop the dollar's slide. A weaker dollar raises the prices on Japanese exports to the United States. Japanese businesses, particularly those heavily dependent on exports, have just begun to adjust to the 40 percent drop in the value of the dollar that has occurred since 1985.

The Tokyo stock market, meanwhile, also ended the day substantially down, with shares declining across the board but especially in export-related, and thus foreign-exchange sensitive, areas. The Nikkei average of 225 selected shares closed down 543.64 yen to 22,033.89 yen.

Securities experts said foreigners again led the way in selling stocks, while the continuing instability of the dollar prodded others to sell, particularly in the afternoon after the dollar dropped below 138 yen.