Harassed to the last by a flotilla of antinuclear demonstrators. Japan's only nuclear-powered ship finally made it to port for repairs yesterday - four years late.

The Mutsu, an experimental cargo ship, slowly wound its way to a dock in this port city in southern Japan, outlasting an unlikely armada of motorboats manned by nuclear opponents who had hoped to block its arrival.

The confrontation underscored Japan's strong "nuclear allergy." Four years ago, the Mutsu's nuclear reactor sprang a leak on its first voyage, and it became the most unwanted vessel in a country that has been deeply suspicious of all nuclear power since being atom-bombed in 1945.

In 1974, the Mutsu was forced to wander at sea for 43 days because no port would take a ship with a leaky reactor. It finally docked at its home port in northern Japan amid protests from local fishermen and remained there idle until Sasebo finally agreed, relunctantly, to accept it for repairs this week.

To placate opponents, the keys to the Mutsu's nuclear reactor were turned over to local officials as insurance that the machinery will not be operated while in a port. It will take three years to build a new 350-ton concrete shield around the reactor.

The Mutsu's welcome was anything but gracious. The antinuclear flotilla swarmed in and out of its path while the demonstrators - clad in skin-diving suits and life preservers - shouted denunciations through bullhorns.

At one point, harbor police attempted to seal the protesters in one corner of the channel by stretching out a long floating boom usually used to contain oil spills. But many of the small boats got over or around it and returned to the challenge.

Finally, the boats heeded coast guard warnings and fell back out of range while the Mutsu slowly drifted to dockside, pestered only by three boats operated by young radicals. Two small boats capsized during the engagement and six man were dumped into the harbor.

On shore, about 4,600 demonstrators paraded around Sasebo, protesting at the mayor's office under the guard of the 4,000 riot police.

The long Mutsu controversy has left an embarrassed government unwilling to consider future nuclear ship development. After the ship docked, the vice minister of science and technology, Katsuhisa Kamijo, said yesterday. "For the moment, the government has no plans for a second or third nuclear ship. What we should do is complete the Mutsu as a perfect experimental ship."

The opposition in Sasebo is a coalition of varied groups - socialists who think the government is lying about nuclear development, fishermen who do not want their fishing grounds endangered by radiation, and atom-bomb victims from nearby Nagasaki.

The Matsu sharply divided the local community. Officials were cajoled into letting her dock here by economic arguments. This is the center of a depressed shipbuilding industry and the repair company, Sasebo Heavy Industries, Inc., badly needs the business.

A local labor leader, Tooru Kojima, said his ranks are split. He and the leadership are opposed on moral grounds to all nuclear power, he said, but some of the rank and file members want jobs. They are poor and they have to work, he said.

The Socialist Party, which organized yesterday's demonstrations, is not against peaceful nuclear development, but fears the government is concealing Mutsu's real purpose. One local Socialist leader, Yasuyoshi Koga, said yesterday, "Nuclear power is not yet usable for commercial ships. It is only worthwhile for atomic submarines. So we think that the government is only using the Mutsu as a first step toward making a nuclear submarine, which would make it the first nuclear rearmament in Japan."

The Matsu drama - some call it a farce - reflects the fierce resentment many japanese still feel toward any form of nuclear power. It is fueled by a widespread feeling that Japan, the only country to be attacked by nuclear weapons, should have nothing to do with any type of nuclear gadgetry. Lawsuits and large protest demonstrations have opposed nearly every nuclear power plant built in Japan in the past decade.

Construction of the Matsu was first announced in 1968 by a government eager to prove that safe nuclear-powered ships could become the mainstays of this country's commercial fleet. Japan's massive shipbuilding industry, it was thought, could sell such vessels to the world.

Ten years after its construction was first announced, four years after the abortive first voyage to sea, the Mutsu, dubbed "the Japanese Flying Dutchman," still a political hot potato no one wants to handle. The government of Nagasaki Prefecture, where Sasebo is located, said for example, it would accept the ship only if the nuclear rods were first removed from the reactor. That satisfied nearly everybody except the Prefecture in northern Japan where the Mutsu was berthed. Under heavy pressure from local opponents, the government there said that under no circumstances could the ship's nuclear rods be removed while in port there.

Finally, the Nagasaki Prefectural Government agreed to accept the Mutsu but insisted that the reactor be locked and inoperative while the shielding around it is repaired.

Still the local protests continued - 30 dissidents were arrested for demonstrating on the day last June when the local assembly agreed to accept the ship. The organizations of atom-bomb victims are centered in nearby Nagasaki and exert considerable influence in local affairs. A 150-ton "people's ship" was chartered and dispatched with a crew of 50 anti-nuclear campaigners to harass the Mutsu on its journey here.

Eminent scientists have joined the opposition, asserting that the Mutsu was poorly designed and should never have been sent to sea without preliminary shore tests of its reactor. The Mutsu, says Tokyo University physicist Shu Ono, "is a haunted house" filled with design problems that may never be solved. Politicians who support nuclear power say the government never took the time to build public support for the Mutsu.