QUINCY, Mass. (AP) _ In a bittersweet ceremony Saturday, the General Dynamics shipyard christened its last ship, ending 102 years of shipbuilding along the Fore River.

Hundreds of residents and former employees gathered in the rain as company and military dignitaries praised the men who built more than 500 Navy battleships, cruisers, aircraft carriers, destroyers and submarines at the shipyard since 1884.

''Perhaps in the rain there is a message,'' said Gen. Paul X. Kelley, commandant of the Marine Corps. ''Perhaps the good Lord and all those former Fore River workers who have gone to their last reward are up there weeping ... and hoping there may be a miracle.''

General Dynamics announced last year it would close the shipyard because of the decline in Pentagon contracts. The shipyard, which produced 71 destroyers in World War I and 227 ships during World War II, had been hired to deliver only six military ships since 1973.

The work force, which reached 32,000 in 1943, was down to 4,300 when the company announced the closing.

General Dynamics spokeswoman Evelyn Murphy said the work force has been reduced to 600 and will continue to be cut though the rest of the month. She said about 100 employees will be kept through the year for security, maintenance and clerical work.

Mary DiTullio of Quincy, whose father, three brothers, husband, son and four nephews worked at the yard for a total of 232 years, was selected by General Dynamics to christen the Sgt. William R. Button, a 671-foot Marine prepositioning vessel.

''It's both happiness and sadness,'' Mrs. DiTullio said before the ceremony. ''It just doesn't seem possible the yard is closing. ... I wish somebody out there would say, 'It's not going to close.'''

Hundreds of red, white and blue balloons were released, the ship's whistle blew and a band struck up ''Anchors Away'' as Mrs. DiTullio smashed the champagne bottle against the Button's black hull.

Smiling children pointed and laughed as parents took pictures. But many middle-age and elderly men who spent most of their adult lives at the shipyard looked on expressionless. Some just looked away.

''Terrible, terrible, terrible,'' muttered Alfred Mikson of Lynn, who was laid off Friday after 29 years as a welder.

''It's just a shame. ... Ninety percent of my life has been on ships,'' the 70-year-old Navy veteran said.

The shipyard was founded as the Fore River Engine Co. in 1884 by Thomas Augustus Watson, better known as the assistant who helped Alexander Graham Bell invent the telephone.

In 1900, he moved the plant to its present location two miles away and declared his goal to create the nation's largest shipyard. The company's first Navy ships, two 400-ton destroyers, were delivered in 1903.

The company was sold in 1913 to Bethlehem Steel, which ran the yard until it was sold to General Dynamics in 1964.

Rep. Silvio O. Conte, R-Mass., the keynote speaker at Saturday's ceremony, pledged to continue working to find a company to reopen the 180-acre plant. One plan would have the workers buy the shipyard.

General Dynamics officials, including Chairman Stanley C. Pace, said workers should be proud that the Button was finished on time and within budget.

''We will watch her go with sadness, knowing that a great era is coming to an end. But we will watch her go with pride. She carries with her a great tradition,'' said Gary S. Grimes, general manager of the shipyard.

The vessel, which the company said will be used to ''contain a conventional conflict anywhere in the world where U.S. vital interests are threatened,'' was named for a Marine who helped quell an insurgence by bandits in Haiti in 1919.