TOKYO, June 7 (Reuters) - Japan's Nikkei index gave up most of its gains to end flat on Tuesday as a rally by automakers and energy related shares was overshadowed by concerns about U.S. inflation and interest rate rises.

The index inched up 0.1% to 27,943.95, after crossing the 28,000-mark for the first time since March 31.

The broader Topix rose 0.41% to 1,947.03.

"The Japanese market is better positioned than the U.S. market but the main players in Japan are foreigners, and they do not want to make bets when the U.S. is tightening monetary policy," said Shigetoshi Kamada, general manager at the research department at Tachibana Securities.

"There will be a solid demand for stocks in Japan, as domestic companies have set aside a lot of cash to buy back their own shares."

Automakers rose after the dollar jumped versus the yen. It was helped higher by expectations of persistent inflation pushing up U.S. bond yields.

Mazda Motor climbed 4.17% and was the top gainer among shares in the Nikkei. Honda Motor rose 2.52% and Toyota Motor gained 1.27%.

The auto and parts makers sub-index rose 1.55%.

Oil explorers advanced 2.99%. Theirs was the top gainer among the Tokyo Stock Exchange's 33 industry sub-indexes, supported by oil prices inching higher.

Heavyweight chip-related stocks weighed on the Nikkei, with Tokyo Electron losing 2.11% and Advantest sliding 2.51%.

Kawasaki Heavy Industries lost 4.36% and was the worst performer on the Nikkei after the heavy machinery maker said there had been misconduct at a subsidiary. (Reporting by Junko Fujita; editing by Uttaresh.V and Bradley Perrett)