TOKYO (AP) _ Ronald Reagan threw the first pitch in a Japanese championship baseball game Tuesday, nearly hitting the batter, and his wife, Nancy, inaugurated the Japanese chapter of her anti-drug program.

The former president met with two former prime ministers and, at a reception for Americans working in Japan, praised the ''ever-growing closeness'' between the two nations.

A capacity crowd of 56,000 at the Tokyo Dome cheered as Reagan tossed the first pitch in the third game of the Japan Series, the Japanese version of the World Series, from about halfway between the mound and home plate.

The one-time sportscaster wound up and fired a ball that nearly hit Daijiro Ohishi of the Kintetsu Buffaloes on the posterior.

Reagan laughed and waved to the cheering crowd, Ohishi backed away and the visiting celebrity tossed another ball over the plate.

Announcements during the game between the Buffaloes and the Yomiuri Giants asked fans for donations to victims of last week's San Francisco earthquake ''to promote U.S.-Japanese relations.'' The quake, which measured 6.9 on the Richter scale, struck shortly before the scheduled start of the third game of the World Series in San Francisco.

Mrs. Reagan spoke to a group of experts on preventing drug abuse about the importance of action on the narcotics problem. Drug laws are strongly enforced in Japan and there is comparatively little abuse, except of barbituates.

''People in Japan still think that drugs are not a serious problem,'' said Fumiyo Mizushi, secretary-general of Just Say No Japan. ''Mrs. Reagan said that attitude is very dangerous.''

He said clubs would be formed in schools to raise awareness about drugs.

Reagan, 78, is on a nine-day visit at the invitation of the government and Japan's largest media conglomerate, Fujisankei Communications Group.

Fujisankei has said it is spending about $7 million on the trip, which it hopes will help improve U.S.-Japanese relations. Fujisankei officials have refused comment on reports that the Reagans are being paid $2 million.

Except for meetings with Japanese officials Monday and Tuesday, Reagan is spending his time in appearances planned by Fujisankei, which owns television, radio and newspaper companies.

The former president had lunch Tuesday with Yasuhiro Nakasone and Noboru Takeshita, both of whom served as prime minister during his eight-year presidency.

''I asked Mr. Reagan what he has been doing since he stepped down, and he said he has been traveling around the country giving speeches and playing sports,'' Nakasone said afterward.

''We said we've been involved in various election campaigns and in sports. We all agreed to do our best to remain active.''

At an evening reception sponsored by U.S. Ambassador Michael Armacost, Reagan said the ever-growing involvement of Americans and Japanese in each other's societies was ''how it should be.''

''We admire each other's culture, we understand our differences, we learn from each other and we build friendships and partnerships which enrich our lives,'' Reagan said.

He did not comment on economic friction, which has increased as more Americans see Japan as a threat.

On Monday, Reagan met with Prime Minister Toshiki Kaifu and Emperor Akihito. The emperor gave him one of Japan's highest awards, the Grand Cordon of the Supreme Order of the Chrysanthemum, for promoting free trade and friendship.