Twenty-nine of the 38 hostages held by inmates in a barricaded kitchen at a Pennsylvania prison made their way to freedom through a back window yesterday, apparently let go by their captors, while violence was reported at prisons in two other parts of the nation.

Nine hostages were still being held at gunpoint in the maximum security state prison at Graterford, Pa., where they have been since Wednesday night when four rebel prisoners were thwarted in their attempt to scale a prison wall. The remaining hostages included three prison guards, three civilian prison employes, and three other inmates whom police now say may or may not have joined the captors.

Late Friday night and early yesterday morning, three hostages managed to escape from the kitchen. Then, just before noon yesterday, 26 more hostages got out of the prison.

"We are of the opinion now that they have been let go," said Correction Bureau spokesman Kirk Wilson of the 29 inmates. The freed hostages were taken to the prison infirmary, and they appeared to be in good health, officials said.

Corrections Bureau spokesman Kenneth Robinson said early in the day that negotiations had hit a snag. Prison officials had provided blankets and cigarettes and asked that the captors release hostages with medical problems. "We haven't gotten back in return what we've asked for, which is part of the difficulty," he said.

The four captors were believed armed with one handgun and possibly several kitchen knives, and prison officials say they were led by Joseph Bowen, 35, convicted of murdering a warden and deputy warden at a Philadelphia prison in 1973 while serving a life term for the killing of a police officer.

An admitted captor, who identified himself Friday as Calvin (Pepper) Williams, is serving life for murder. He identified the two other alleged captors as LeRoy Newsome, 29, convicted of the 1972 gang-related slaying of a 14-year-old boy, and Lawrence Ellison, 26, found guilty of a torture-beating and robbery in 1974.

Meanwhile, a third day of racial fighting at the California Rehabilitation Center 50 miles east of Los Angeles ended yesterday after guards wounded five inmates with birdshot. Brawling had started Thursday among 200 black inmates and 250 Hispanic inmates.

In Michigan, one inmate died and two others were wounded in three separate stabbings over the past few days at Southern Michigan Prison, the world's largest walled prison.