The deceased was identified as Kamrul Islam.
Ratna Roy, senior jail superintendent of Rangpur Central Jail, said Kamrul had been suffering from depression.
"He tried to commit suicide by hanging herself with his bedsheet around 5:00 am and got injured critically," Ratna said.
He was later taken to the hospital where doctors declared him dead, the jail official said.
Rathish, a public prosecutor at the Special Judge's Court in Rangpur, was killed over alleged extramarital affairs between his wife Snigdha Sarkar Dipa and Kamrul on March 29.