TOKYO, NOV. 23 -- In the most mysterious event of his month-long enthronement extravaganza, Japan's Emperor Akihito spent six hours last night in two small bedchambers communing with the spirit of the Sun Goddess.

Carrying out a solemn harvest-time ritual of thanksgiving that dates back about 2,000 years, the emperor performed the rites known as the Daijosai, or Great Food Ceremony, to offer Japan's Shinto deities the first fruits of the year's rice crop.

About 800 distinguished guests dressed in formal attire -- the cream of Japanese society, business and government -- shivered in the dark on folding chairs outside the curtained chambers.

The only thing they, or the television audience, could see of the emperor was his torchlit procession, accompanied by dozens of attendants, courtiers and food bearers in white robes, to the specially built shrine where the spirit of the goddess Amaterasu was said to be reclining on a bed made of rice straw.

For all the mystery, most of Akihito's 123 million subjects went about their business yesterday paying minimal attention to the emperor's once-in-a-lifetime Daijosai ceremony. Even as the emperor was in the shrine, a microskirted bar girl in Tokyo's teeming Shimbashi nightclub section was enticing customers with the promise, "Better rice than at the Daijosai!"

The emperor's nighttime food offering ritual inside the windowless shrine, newly erected in a garden of the imperial palace here, contrasted sharply with the lavish midday public rites Akihito carried out 11 days ago when he formally took his place on the Chrysanthemum Throne.

That ceremony, a riot of color and spectacle, took place in full view of a national television audience and 2,500 princes, presidents and prime ministers invited from 158 countries around the world. Furthermore, the enthronement ceremony was completely governmental in character, with virtually no religious elements.

Last night's more somber Great Food Ceremony, with restricted television coverage and only Japanese guests invited, combined elements of Japan's indigenous Shinto religion with a celebration of the rice-growing culture that has shaped Japanese society for 20 centuries -- joining, in effect, the mythical and the historical elements of Japan's imperial family, the oldest surviving monarchal dynasty on earth.

The ancient Shinto texts teach that the Sun Goddess, Amaterasu-no-mikami, sent her grandson to Japan sometime in the murky chapters of proto-history, and all emperors since then have been descendants of that divine family line. By this legendary accounting, Akihito is the 125th generation of his family to hold imperial sway.

Historians say the emperor system probably goes back to the time of Christ, when residents of central Japan started rice cultivation and began to develop an organized state. Fairly meticulous written records indicate that the imperial line is unbroken at least to the seventh century A.D.

The imperial throne has always had a close connection to the rice culture. And it was rice that determined the timing for Akihito's various rites of accession this fall.

Akihito has been emperor from the moment his father, Emperor Hirohito, died on Jan. 7, 1989. But he could not formally take the throne without performing this food offering ceremony. And tradition dictates that the emperor cannot make this ritual offering with rice grown in the year the former emperor died.

Thus Akihito had to wait until this month to use rice newly harvested from the 1990 crop. His enthronement ceremony on Nov. 12 was scheduled to accommodate last night's food offering ceremony.

Preparations for last night's event went on all year long. Early last spring, Shinto priests burned a tortoise shell and then examined the ashes to determine the precise rice fields -- one from a province east of the imperial palace and one from the west -- that would provide the food for the emperor's offering. The actual rice that Akihito offered to the gods was selected one grain at a time by Shinto practitioners.

Since both eastern and western rice was used, Akihito performed his food offering twice last night, spending three hours in each of two identical bedchambers roughly the size of a small elementary school's gym. Together with his processions and a ceremonial interlude, the whole ceremony lasted until 3:30 this morning.

According to experts, the emperor, wearing a white kimono and a crown with a drooping black plume, was to kneel on a rice-straw mat next to the bed where the spirit of the goddess reclined. She was then supposed to sit on another mat beside him as they shared new rice, other grains, fruit and sake, or rice wine. There was at least one foodstuff from each of Japan's 47 ken, or provinces.