W. Wilson Goode, the sharecropper's son who is seeking to become this city's first black mayor, defeated former mayor Frank L. Rizzo in the Democratic primary after taking the lead early this morning on the strength of late reporting black precincts.

With 1,763, or 98 percent, of the city's 1,794 precincts reporting, Goode led Rizzo by 312,219 votes to 270,115, about 53 percent to 46 percent.

The race, pitting Goode against the once flamboyant Rizzo, who was trying to resurrect his political career, appeared to have drawn a heavy turnout of the city's record 899,882 registered Democrats.

Rizzo spoke to reporters early this morning but declined to concede. "The numbers are not all in yet," he said. "We'll just wait until tomorrow today and see what the final count is."

Goode claimed victory at 1:25 a.m. before several thousand wildly cheering supporters at the Philadelphia Civic Center. "We are not against anyone, we are for everyone who lives in this city," he said.

After a campaign notable for its decorum and its absence of racial appeals, Goode, 44, the city's former managing director, appeared to have won more than 95 percent of the black vote and about 25 percent of the white vote, according to exit polls of about 3,000 voters at 100 polling places by the NBC and CBS local affiliate television stations.

The vote count was slowed through the evening by long lines that left some of the city's nearly 900,000 registered Democratic voters still waiting at the polls as late as 10 p.m., two hours after they officially closed. Election officials closed the lines at 8 p.m. but allowed those in line to go ahead and vote.

Goode's victory ended the comeback bid of Rizzo, 62, one of the nation's most colorful and controversial urban political figures of the 1960s and 1970s. Rizzo tried without apparent success to soften his image and cater to an electorate no longer so transfixed by the hard-edged law-and-order appeals that were once his stock in trade.

Tom DeVries, an analyst for Teichner Associates, which conducted exit polling for the local CBS station and The Philadelphia Inquirer, said that 62 percent of Democrats interviewed had a negative impression of Rizzo and 76 percent had a positive feeling about Goode. He said that Goode's strategy of attacking Rizzo's record and reminding the voters of what they didn't like about him apparently had worked. "People said that Rizzo was out of date, phony and a bad manager," DeVries said. "Race just doesn't seem to have been a factor in the campaign."

In a hard-fought Republican mayoral primary, stockbroker John Egan was winning. With 89 percent of the vote counted, Egan had 36,367 votes; former representative Charles F. Dougherty had 23,588, and Thomas Gola, an ex-city controller and professional basketball star, had 19,944.

In Philadelphia, Democrats outnumber Republicans by more than 5 to 1. Goode is expected to be the heavy favorite in the general election.

A third major candidate is waiting in the wings for the November election--former city controller Thomas Leonard, who dropped out of the Democratic primary when he found himself in the middle of Rizzo's and Goode's campaigns.

There has been a black candidate for mayor here for the last four consecutive elections, and their effectiveness in terms of money raised, street organization and percentage of votes has risen with each outing. Moreover, in the past decade, independent blacks have moved into mainstream political positions of power in the City Council, the school board and the city's legislative delegations.

After incumbent Mayor William J. Green announced last fall that he would not seek reelection, many black leaders, and some white ones, sensed that 1983 was the year for a black to capture City Hall. Goode was the virtually unanimous choice of the black leadership to make the race. Though he had never before sought elective office, he had been highly visible in his three years as managing director, an appointive position that controls the city's 10 operating departments. Whenever there was a fire, a police shooting or any hint of neighborhood tension, Goode was always first on the scene. "A lot of blacks already think of him as the mayor," said District Attorney Edward Rendell, "and they see this campaign as just making it official."

In some ways Goode presents the ideal profile for a black candidate in a majority white city that has undergone its share of racial tension in the recent past. He is a reassuringly low-key, devoutly religious church deacon who favors conservative suits and starched white shirts.

He spent about half his time campaigning in the city's white ethnic lunch-bucket neighborhoods, where his energy as managing director made him a familiar figure and won him a modest following. When he campaigned among blacks, he studiously avoided the "it's-our-turn" rhetoric that characterized the early campaign this year of Chicago Mayor Harold Washington.