LONG BEACH, Calif. (AP) _ Prince Andrew and his wife, Sarah, went to church with everyday Americans on Sunday morning and later dined with Hollywood elite in the evening at a gala that included a British celebrity entourage.

The Duke and Duchess of York, who are on a tour to promote British trade, arrived at St. Luke's Episcopal Church shortly after 11 a.m. after a motorcade from the royal yacht Britannia, which is docked at Long Beach Naval Station.

Unknown to the royal retinue and the press, police officers sweeping the motorcade route had detained a man they spotted carrying a rifle. But it turned out that the man's presence had nothing to do with the royal visit and the rifle was unloaded, police said.

Later in the evening, the duke and duchess were the guests of honor at a star-studded dinner at the Biltmore Hotel in downtown Los Angeles.

Among the 700 guests paying $1,000 apiece to dine with British royalty were Zsa Zsa Gabor, her husband Prince Frederick von Anhalt, British-born ''Dynasty'' star Joan Collins, her date George Hamilton, and British actors Michael York and Roger Moore. Moore served as master of ceremonies.

Money raised by the event benefits the three-month UK-LA '88 art festival and a fund to salvage books damaged in disastrous 1986 fires at the Los Angeles Central Library.

Earlier, the couple were greeted by a cheering crowd waving miniature Union Jacks as they went to church under British-style drizzly skies.

The Rev. A. LeRoy Young, rector of St. Luke's, officated over matins, a morning service of prayer and song. Andrew read the day's lesson from Romans 8:31.

In his sermon, Young noted the presence of the couple.

''I think the majority will agree with me that their presence here today is the biggest thing that has happened in this city since the Richfield oil refinery exploded, and that was in 1933,'' he said.

Ten minutes before the royal couple arrived, British Ambassador Anthony Acland, Consul General Donald Ballentyne and their wives, pulled up in a limousine that had been smashed on one side. The accident, which caused no injuries, was blamed on a driver who ran a red light a few blocks from the church, said British consulate official Stewart Granger.

About 300 people lined the sidewalk across from the church, some packed under a bus shelter to avoid the occasional showers.

Blanche Schulman, a war bride originally from London who sported a British- made umbrella, said the event reminded her of damp monarch-watching excursions of her youth.

''I'm very excited. ... The rain to me is part of everything. It's just like home,'' said Mrs. Schulman, 64.

Elaine Tuttle, 73, and Myrna Dillon, 48, both of Long Beach, perched on stepladders in hopes of catching a glimpse.

''We love them, we really do. We follow their every move,'' said Ms. Dillon.

Asked if she had watched the weddings of Andrew and Sarah and Charles and Diana on television, she replied, ''We didn't just watch them, we watch them all the time. We have them on tape.''

The incident with the man with a gun did not change the royal couple's itinerary Sunday morning.

John Kasser of Long Beach had retrieved a .22-caliber rifle from the police station there and was headed to his car when Los Angeles city police officers spotted him, said Long Beach Lt. Rod Mickelson. The gun had been held by police for safekeeping for several days after officers confiscated it during a domestic dispute, Mickelson said.

Kasser was later freed and allowed to keep his gun, police said. He was not charged Sunday, nor had he been charged in the domestic dispute, Mickelson said.

''There's absolutely no relation between him and the motorcade,'' he said.