SAN DIEGO (AP) _ During 77 days in the Persian Gulf, the USS Fox endured sightseers, goat- laden boats seeking gas and ''Miami Vice''-type smugglers as well as the threat of mines and terrorist attacks, its commander said.

The guided missile cruiser was part of the first convoy that escorted U.S.-flagged Kuwaiti oil tankers through the gulf, a job that meant nearly constant tension for his crew, said Capt. William W. Mathis.

The cruiser was within 1,100 yards of the Bridgeton when the tanker struck a mine July 24 near the Iranian island of Farsi. The 483 USS Fox crewmembers also had to cope with crowded sea and air lanes that made it tough to distinguish friend from foe, Mathis said Tuesday.

''There are hundreds of small craft in the gulf. Smugglers make regular runs ... and they all have speedboats that look like something out of 'Miami Vice,''' said Mathis.

''It's a very confusing picture out there.''

Some of the speedboats matched the description given to U.S. naval ships of terrorists operating in the area.

Despite the constant threat of danger, the commander said, ''I never fired my guns in anger. I fired them in warning a couple times.''

Flares were fired at an oil rig supply helicopter out of Saudi Arabia when the pilot initially refused to identify himself, and at a boat that came in too close, he said.

''This guy was a tourist,'' said Mathis, but his vessel matched the description of Iranian terrorist boats said to be carrying thousands of pounds of dynamite.

Another incident involving a boat sent the Fox into general quarters alert but ended with a whimper.

As the giant cruiser steamed up the gulf, a speedboat began matching its path, despite the Fox's effort to maneuver away, Mathis recalled. Crewmen manned 50-caliber guns when the speedboat drew within 500 feet and a man aboard was spotted grasping something.

''We were about to open fire ... when I realized he had a boatload of goats and he was looking for gas,'' Mathis said. He would have supplied him but the man, who kept waving a blue gas cannister but didn't speak English, gunned his boat away.

The Fox, along with another escort ship, the USS Valley Forge, returned to San Diego on Oct. 13. Mathis called the May 31 through Aug. 15 mission a successful deployment, and said he had no doubt the ships could have protected themselves if an attack had been launched.

The gulf has been increasingly tense with escalation of the 7-year-old Iran-Iraq war. Iran says Kuwaiti aids Iraq.

The Bridgeton was the first of the Kuwaiti tankers to fly the U.S. flag and the only reflagged tanker that hit a mine. Following that, the Pentagon responded with a buildup of minesweeping equipment, including mine-hunting ships.

On Oct. 16, a Silkworm missile believed to have been fired by Iran struck a U.S.-flagged Kuwaiti tanker, Sea Isle City.

News reporters were allowed aboard the USS Fox for seven days during its escort duties, and Mathis called the coverage fair and said it prompted messages of support from around the United States. The captain reviewed each article before it was sent but said there was no censorship.