The leader of the upstate sex cult Nxivm is trying to use the frigid conditions at Brooklyn’s Metropolitan Detention Center to finally get out of jail.

“MDC has been without heat, electricity, hot water, commissary or warm food since January 27, 2019, following an apparent fire in the institution,” read court papers filed Friday by Keith Raniere’s lawyer, Marc Agnifilo.

The filing comes as a supplement to Raniere’s third attempt to convince Brooklyn federal court Judge Nicholas Garaufis to release him on bond ahead of his upcoming trial on sex-trafficking conspiracy and other charges.

The suspect has been jailed since his arrest in April.

Earlier Friday, sources told The Post that the jail is running on emergency power and that two-thirds of inmates have been without heat for nearly a week during the cold snap.

“Raniere has relayed to us, through a colleague in the Federal Defender’s Office, that MDC has not provided Raniere with any means to keep warm — and apparently the temperature in the institution is 44 degrees,” the filing reads. “Raniere has also informed us that the corrections officers are wearing masks to mask the smell of noxious fumes, but have not provided any masks to the inmates.”

Agnifilo notes that he and other counsel have been barred from visiting Raniere during the chaos.

Raniere is the only one among his co-defendants, which include the likes of “Smallville” TV actress Allison Mack and Seagram’s heiress Clare Bronfman, who remains behind bars.

Prosecutors have accused the group of operating a secret inner society within Nxivm where female members where branded and offered up to Raniere for sex.

Agnifilo has said that any sex that took place was between consenting adults.

Opening statements are expected April 29.