A Rikers correctional officer was locked in a pantry and attacked by an inmate Wednesday morning — but other prisoners rushed to the woman’s aid, law enforcement sources told The Post on Wednesday.

Raphael Davlos allegedly lured the woman into the closet in a dorm at the Anna M. Cross Center and locked the door behind the pair before wrapping his shirt around the officer and strangling her.

Davlos, who is awaiting trial after being arrested in August 2018 on robbery and forcible touching charges, allegedly told the woman another officer left pepper spray in the pantry.

When the officer went to check, Davlos allegedly put a sweatshirt around her neck and strangled her and dragged her with it, before several inmates busted into the room and saved her, the sources said.

Correction Officers’ Benevolent Association president Elias Husamudeen on Wednesday confirmed the man had been charged by the Bronx DA in the new assault — but the specifics were not immediately available.

“Thank God for the officers who were there and the inmates that were there because they kicked open that door and came to her side,” said Husamudeen. “She’s OK, thank God. It could have been worse.”

“[He] was really choking her,” Husamudeen said of the attack. “Threw her on the ground. She hit her face on the floor.”

The woman was taken to the hospital but has since been released.

The assault comes less than 12 hours after another Rikers officer’s shoulder was dislocated — allegedly by one of the gangbangers facing life in prison for the murder of Lesandro “Junior” Guzman-Feliz.

Jose Muniz, a member of the notorious Trinitarios gang, sent the guard to the hospital on Tuesday night.

Husamudeen said Muniz punched the guard in the face, “attacking him and kicking him and dislocating his shoulder and fracturing his back” — and claimed Muniz bragged, “I have nothing to lose” during the attack.

The union called for better safety measures to increase security in the city’s jails.

Muniz is facing life in prison after a jury on Friday found he and four other gang members guilty of first-degree murder, second-degree murder, second-degree gang assault and second-degree conspiracy.

They are being held at Rikers while they await sentencing.

He showed no remorse on Friday, yelling “Popote!” and “Hasta la muerte” — meaning “Trinitarios until death” — as he and his fellow thugs were led from the courtroom in chains.