Mayor William Donald Schaefer, who has established himself in the psyche of this city's 785,000 residents as the symbol of its rebuilding, overwhelmed challenger William H. Murphy Jr. in the Democratic primary tonight to virtually assure himself of a fourth term in office.

Schaefer received 71.5 percent of the vote to 26.2 percent for Murphy, a former Circuit Court judge. According to unofficial returns, 227,714 votes were cast in the Democratic mayoral primary.

Schaefer appeared before his supporters at the Lyric Opera House at 10:45 p.m. accompanied by Sen. Paul S. Sarbanes (D-Md.) to declare: "The victory is here. . . .

"What do you say when you feel so happy. I don't really know how to start, sometimes words are inadequate, but the words in English I want to say are thank-you. . . ," Schaefer said.

"The good thing about this campaign is that it gave our people a chance to look back 12 years and see what we have done in the neighborhoods," Schaefer told his delighted supporters. He also pledged to "take much more interest in education," a reference to Murphy's calling the city school system "lousy."

Murphy, a member of one of Baltimore's most prominent black families, maintained throughout the campaign that Schaefer, who is white, had been a good mayor for white males but a poor one for blacks and women. Although he received endorsements from many national black leaders, Murphy's support in the black community here was mixed, and that fact was reflected in tonight's figures.

Murphy appeared before his supporters at 11:25 p.m. to say: "My quest for the mayor's office has fallen short--this time. But always remember, the dreamer may stumble, the dreamer may fall, but the dream itself of equal opportunity for all Baltimoreans will never die."

When Murphy offered congratulations to Schaefer, many in the crowd at the Belvedere Hotel began booing. Murphy held up his hands and said, "No, no. He won the election and we must congratulate him."

Schaefer won easily on a day when a record number of the city's voters--more than 200,000 of them--ignored an all-day rain to turn out and vote. They also elected City Council President Clarence (Du) Burns to a full term in that job over challengers Mary Pat Clarke and William A. Swisher. Comptroller Hyman Pressman also was reelected, winning a sixth term against challenger John Douglass.

Schaefer, 61, will face a Republican challenger, Samuel Culotta, a businessman also nominated in today's primaries, in the November general election. In a city where Democrats outnumber Republicans 10 to 1 and no Republican holds elective office, today's vote was widely seen as the one that mattered.

Registration drives by supporters of Schaefer, Murphy and candidates for the 19-member City Council swelled the city's registration to about 424,000--of whom 368,000 are Democrats--the highest registration in Baltimore since 1971, the year Schaefer was first elected mayor.

Both Democratic mayoral candidates toured the city while the polls were open before retreating for final respites before meeting their supporters tonight. Schaefer, always the early riser, cast his ballot at 7:30 a.m. He told reporters later in the morning, "I'm as nervous as a candidate can be on election day, but that's the way you're supposed to feel."

Of the heavy turnout, Schaefer said, "I'm not surprised at all. I've felt there was more interest in this campaign than any I've seen here in years."

Schaefer, the darling of the city's business community, had little trouble raising money--more than $750,000--and had a steady stream of television and radio commercials built on the theme that a vote for Schaefer is "A Vote for Baltimore."

By contrast, Murphy's campaign was in debt much of the summer: His television spots were limited to the last two weeks before the election, and he was forced to go to other cities, including Los Angeles, San Francisco, Atlanta and Washington, in search of funds.

"Most of the money in Baltimore is tied up with Schaefer, as you would expect," Murphy said last week. "That's one of the reasons why this city needs new direction."

Hoping to capitalize on the recent trend that has seen blacks unseat white mayors in several big cities, Murphy imported several well known black leaders, including Georgia State Sen. Julian Bond, who toured polling places with Murphy today. Earlier, the Rev. Jesse Jackson, former Atlanta Mayor Maynard Jackson, Atlanta Mayor Andrew Young, and Martin Luther King III, son of the slain civil rights leader, campaigned here with Murphy.

In his two previous elections, Schaefer faced little opposition, and voter turnout in those years was less than 33 percent, reflecting a lack of effort by candidates to get voters to the polls. Today, however, lines were long throughout the city with candidates in all the races having organized their workers to give rides, make phone calls and encourage voters to ignore the rain in order to cast their ballots.