TOKYO (AP) _ The U.S. dollar rose against the yen Thursday morning while the key index on the Tokyo Stock Exchange erased its early gains and ended the morning session lower.

The dollar was changing hands at 145.47 yen at late morning. The currency opened at 145.50 yen, up 0.40 yen from Wednesday's 145.10-yen close, and ranged between 145.40 yen and 145.62 yen.

The 225-issue Nikkei Stock Average lost 121.06 points, or 0.32 percent, ending morning trading at 37,180.81. It had gained more than 160 points in early trading and fell back later.

The leading indicator, which quickly rose as investment trust companies conducted index-linked buying, fell back as they resold to take profits, said Akihiro Sezaki, a dealer with Nippon Kangyo Kakumaru Securities Co.

''Market players seem to be trying to test the market's endurance after the severe plunges last month,'' he said.

The Nikkei lost more than 2,000 points in early January due to plunges in the Japanese government bond prices that stemmed from the yen's weakness. It has since made up about half of its losses.

But stock investors remain reluctant to buy issues ahead of the general election for Japan's lower house of Parliament, scheduled for Feb. 18, he said.

In quiet currency dealings, the West German mark rose against the dollar and the yen, traders said.

The market was dominated by position adjustments - some investors were selling the mark to take profits following the West German currency's overnight surge on overseas markets, while others were selling the dollar to buy back the mark, they said.

The mark, rather than the dollar, has been the focus of trading recently, because reforms in the Soviet Union and Eastern Europe are expected to benefit the West German economy, said Toru Kanai, a foreign exchange analyst with New Japan Securities Co.

''The yen is less attractive amid uncertainties over the election and speculation on yet another discount rate hike,'' Kanai said.

The mark benefited as investors grew confident in the outcome of the three- day Soviet Communist Party Central Committee meeting that started Monday.

Communist Party leaders Wednesday accepted a proposal by Soviet President Mikhail Gorbachev to give up their monopoly on power.