Armed state prison inmates who held six civilian hostages for six days after an aborted escape, surrendered yesterday after being promised a transfer to a federal prison, officials said.

"All of the hostages are safe," said Paul Critchlow, Gov. Richard L. Thornburgh's press secretary. "The convicts are in custody."

The freed hostages were "in great spirits," said Philadelphia Daily News columnist Chuck Stone, who negotiated the end of the standoff at the maximum-security Correctional Institution.

The hostages were taken to the prison infirmary where Dr. Kemal Dincer said, "Everybody's perfect." Two diabetics among them had been supplied insulin and had urine samples taken during the siege.

At least four convicts had taken 38 hostages after an aborted escape attempt last Wednesday. They were forced to retreat to the kitchen after a tower guard fired a warning shot. The convicts released 29 inmates over the weekend, but three chose to stay with those holding the civilian hostages, officials said.

Officials said they are not sure which or how many inmates were involved in the escape attempt but identified three-time murderer Joseph Bowen, Calvin Williams, Lawrence Ellison and Leroy Newsome as primary hostage takers.

Bowen, who authorities identified as the convicts' leader, at one point in the negotiations "used a whole series of expletives and put his hands on the sawed-off shotgun," Stone said. "I thought here it goes."

A main point of the negotiations was the convicts' demand to serve out their sentences in a federal prison. Officials agreed, and the manacled prisoners were taken from the prison by bus about two hours after their surrender.

Stone, asked to participate in the talks by the governor's office and Bowen's mother, has arranged the surrender of suspects to police on 12 occasions and served as an intermediary in a 1972 disturbance at another state prison.

"This was the preeminent tough one," he said, comparing the Graterford situation with his previous dealings with criminals.