BALTIMORE -- Communities often respond to episodes of racial violence by asking, "How could this happen here?"

But after nine middle school pupils were beaten with baseball bats and metal pipes in a racially motivated melee last week, many residents of Hampden, the working-class neighborhood where the fight occurred, asked, "How could it not?"

"The incident has been a long time in coming," said Edward R. Jeunette Jr., 29, vice president of the Hampden-Woodberry Community Council. "Everyone around here knew there were problems at the school and that there was tension brewing. They were waiting for it to happen."

Less than five miles from the glitter of Baltimore's celebrated Inner Harbor and the concrete-and-glass renovations downtown is Hampden, an enclave that is 99 percent white in a city that is 60 percent black, according to U.S. Census Bureau figures. The residents are mostly working class, proud of their modest homes, and many are descendants of Hampden's first residents.

And many are resistant to blacks, a feeling that has dominated over the years in many of the ethnic footholds of this heavily ethnic city but one that is becoming more anachronistic in an election year that is virtually certain to give Baltimore its first elected black mayor.

Some Hampden residents do not want blacks attending their neighborhood middle school -- where the half-hour free-for-all occurred Wednesday after a white and black taunted each other -- and they are not shy about saying so. The school was integrated 13 years ago under a redistricting plan, and today more than half of its 600 students are black.

"It's never been any different," said Bernard Gilden, the owner of a small grocery store around the corner from the school; his father opened the store 58 years ago. "Hampden is like one of those little towns in Arkansas. When you tell people that they have to have blacks, they just don't accept it. They don't like outsiders coming into the neighborhood."

Hampden, home to 9,500 residents, has remained "a place where even Archie Bunker would look like a liberal," said one store owner, referring to the bigoted protagonist in the television series "All in the Family."

"The neighborhood has stayed white because people want it that way," said Rose Libertini, 25, another lifelong Hampden resident.

The enclave is isolated in a city where blacks and whites traditionally have fought for blue-collar jobs and political power, and which is ethnically diverse, if not sometimes ethnically segregated. Italians, Poles, Germans, Irish, Greeks and blacks have established well-defined communities -- Little Italy, Canton, Fells Point and Highlandtown, for example -- and over the years have fought for their shares of the political pie.

Hampden, which is predominantly Anglo-Saxon and Protestant, was founded in the mid-19th century as a village for workers employed in several cotton mills established along the Jones Falls. The neighborhood immediately adjacent to the Robert E. Poole Middle School consists largely of modest row houses with heavily laden clotheslines hanging in the back yards, and vans and pickup trucks sporting "Buy American" stickers parked in front.

Many residents are descendants of former mill employes and work in the factories that replaced the mills as the area's biggest employers. According to the 1980 census, the vacancy rate for dwellings in Hampden was just 4 percent, reflecting the stability of the population. Residents speak proudly of the fact that many of the families have lived in Hampden for generations, passing down houses to their children and grandchildren. They boast about a crime rate that is among the lowest in the city.

Geography has contributed to Hampden's relative isolation from the urban cares of Baltimore. The community is cut off from surrounding neighborhoods by Druid Hill Park to the south, the Jones Falls Expressway to the west, Johns Hopkins University to the east and a business district to the north.

But along with its small town atmosphere, Hampden has developed a reputation for being hostile to blacks. The Poole school was the site of vigorous protests when the desegregation plan was introduced 13 years ago. Nancy Ansel, president of the Hampden-Woodberry Community Council, recalled an incident five years ago when a black man who got off a bus in Hampden had one of his eyes gouged out by a group of white youths.

"He got off in the wrong neighborhood," Ansel said.

Del. Anne S. Perkins, who represented Hampden in the Maryland House of Delegates for four years before her district was reconfigured, said the hostility that many blacks feel when they are in the community extends to other outsiders.

"My feeling about Hampden is that it was very much a self-sufficient community," Perkins said. "I got the feeling that for someone who was an outsider, myself included, it took something to become part of it. Anybody who is not from Hampden has something to prove."

School officials are still sifting through the conflicting accounts from witnesses and participants in an effort to determine what happened last week. According to city police, who were assigned to back up the school's one guard the day after the incident, the melee started when a 19-year-old white man who lives next door to the school and a 15-year-old black student exchanged words in front of the school.

Soon afterward, the two became involved in a shoving match, and the black student, who was carrying a bat from a softball game at a park across the street, struck the white man, police said. Their friends, watching the escalating fight, joined, and the ensuing brawl spilled into school hallways and the street before it was ended by faculty members and the guard minutes later.

But during the past five years, at least, such episodes have been "relatively rare and relatively minor," said Lt. Edmund L. Bossle of the city police. Last week's incident was immediately seen as more serious because nine students ended up at a hospital, Bossle said. All but one of the students, between 11 and 15 years old, were treated and released.

Poole has been the site of other violent episodes this year, but not all of them pitted blacks against whites. However, the actions of school officials and the comments of area residents in the wake of the brawl suggested that the motivation was widely perceived as racial.

Poole's principal, Herbert W. Findeisen, ordered students to watch a film on race relations at the school on Thursday, and he met with parents and ministers from nearby churches to try to defuse remaining hostilities. Even so, less than half of Poole students showed up for school that day.

A teen-aged girl who had been involved in the brawl said Friday that she did not plan to return for the remaining two weeks of the school year. "I'm not going over there because of all the black people. I'm afraid of what they'll do to me," she said.

In the 13 years since the desegregation plan went into effect, Hampden residents say, they have established an uneasy truce with the busloads of students who arrive on their main street from predominantly black neighborhoods each morning. They freely admit that they are angered and frightened when they run into a group of black youths on the street, and local residents say that if it were up to them, the racial makeup of the school would include more whites.

"If you're not used to growing up around blacks, you're going to be scared when four or five of them come up to you," said Patricia Gregory, 25, who said her fear of blacks caused her to drop out of school at age 15.

Elizabeth Jones, 29, who grew up in Hampden and is raising her son there, said blacks should never have been allowed at Poole. "Hampden is a racial neighborhood. There is nothing you can do to change that."

Other residents, however, resent the blow that this latest incident has dealt to their community. They say that while they are not surprised that the fight occurred, they are surprised by the amount of attention the story has received.

"You can't say it's prejudice, because the black kids don't want to come here, either," said Beverly Hockley, the grandmother of the 19-year-old man who was involved in the fight at Poole. The man's mother, Sharon Devor, showed a visitor photographs of another son on a date with a black girl from the school. The pictures indicate, she said, that her family is not racist.

Hockley and several other residents pointed out that because their community has few activities for young people, youths are bored and fights are common among them. A community swimming pool, for example, was closed last year after a series of fights among white teen-agers there.

Although school officials, police and the community association are discussing ways to ease racial tension in Hampden, several residents said they are skeptical that the efforts will be successful.

"It was a melee between two bums: a black bum and a white bum," said Marvin Hadin, who, with his cousin Mike, owns the second oldest store in Hampden. "In my opinion, it's been blown all out of proportion."

"I'm sure you have a lot of people there who are racist, just like you do in a lot of neighborhoods in the city and around the country," delegate Perkins said. "But you also have a lot of people who are working to build bridges."