Philadelphia Mayor W. Wilson Goode, eager to put a stormy first term behind him, said yesterday he felt "liberated" by his narrow reelection, but challenger Frank L. Rizzo refused to concede and said "nobody could have done better than I did."

Rizzo, a former street cop, police commissioner and two-time Democratic mayor who switched parties to challenge Goode, said he would not give up until the official vote count is completed. That begins Friday and will not be announced until 20 days after the election.

Rizzo, unofficially a 14,000-vote loser, based his slim hopes on as many as 10,000 votes not yet in the computer system and possible errors in transferring totals from voting districts to the computer.

"I lost as far as the unofficial returns go, but now we are going to go through the process that is available," Rizzo told reporters.

Goode had 332,396 votes, or 51 percent, to 318,526 or 49 percent for Rizzo, with only seven of 1,739 precincts uncounted.

In San Francisco, state Assemblyman Art Agnos fell shy of the majority needed to succeed retiring Mayor Dianne Feinstein. He will face city Supervisor John Molinari in a runoff Dec. 8.

In Miami, Mayor Xavier Suarez won less than 50 percent of the vote and faces former mayor Maurice Ferre in a runoff next Tuesday.

In other mayoral elections, Boston's Raymond L. Flynn (D) won for a second time and Houston's Kathy Whitmire and Indianapolis' William Hudnut (R) for a fourth. Palmer DePaulis of Salt Lake City also won a new term.

Democrat Harvey Gantt, the first black mayor of Charlotte, N.C., was upset in his bid for a third term by Republican Sue Myrick, a former city councilor.

In Hartford, Conn., Democrat Carrie Saxon Perry became the first black woman elected mayor of a major northeastern city, handily defeating Republican Philip L. Steele.

The high-profile winners were Democrats, headed by Govs.-elect Wallace Wilkinson in Kentucky and Ray Mabus in Mississippi.

Wilkinson won 65 percent of the vote over Republican state Rep. John Harper, the biggest margin in Kentucky history, and claimed a mandate to enact a statewide lottery and avoid higher taxes.

Mabus, who defeated businessman Jack Reed with 53 percent of the Mississippi vote, said his victory was a signal that the South is changing. "This is a new day for Mississippi," said Mabus, who campaigned as a crusader after a term as auditor spent investigating irregularities by county supervisors statewide.

Julie Anbender, a Democratic National Committee spokeswoman, called the election outcome "a good preview for 1988 . . . . We're extremely pleased. We had expected the gubernatorial victories."

Republican National Committee Chairman Frank J. Fahrenkopf Jr. called the results a "bittersweet success." He made no mention of Harper's landslide loss and did not refer to his oft-repeated claims that a national political realignment toward Republicans is taking shape.

In Philadelphia, Rizzo, 67, hinted that his political career might not be over, although he said he did not foresee another mayoral campaign.

"They've counted me out a lot of times in my life. They'd better not be too sure," Rizzo said.

Goode, 49, defeated Rizzo in the 1983 primary and went on to become the city's first black mayor. But his political stock tumbled after a police bomb was dropped on a west Philadelphia home in a battle with the radical group MOVE in May 1985. Eleven members of the group were killed, and the fire destroyed 61 homes.

Goode won by piling up huge majorities in predominantly black wards and getting key white support in liberal areas.