Authorities say the suspect, Malik Facey, assaulted the captain just before 2:30 p.m. at the George R. Vierno Center.
Facey was taken into custody, and the department is pursuing additional charges.
He was being held at Rikers Island in connection with a July 2019 shooting.
"This was a heinous assault on a captain who was just doing his job," Department of Correction Commissioner Louis Molina said. "Violence against staff is never tolerated. Assaults in jail are as much a crime as assaults on the street, and we are pursuing re-arrest and supporting charges against the individual responsible. We have zero tolerance for assaults on staff."
The weapon used in the attack was recovered, officials said.
The officer was treated at a local hospital, where he remains in stable condition.
The incident is currently under investigation.
ALSO READ | 24-year-old former basketball star gunned down on crowded Queens street
2 men open fired on crowded Queens street killing 1
----------
* Get Eyewitness News Delivered
* Follow us on YouTube
* More local news
* Send us a news tip
* Download the abc7NY app for breaking news alerts