A former cook at a women’s prison in Westchester County is headed to jail himself for having sex with an inmate in the lockup’s kitchen.

Garth Trail, former head chef at the Taconic Correctional Facility, was sentenced Tuesday to four months in jail and 10 years of probation for “engaging in a sexual act” at the state prison in 2017, according to Westchester County District Attorney Anthony A. Scarpino Jr.

Trail, 63, resigned just days after prison officials got wind of the forbidden tryst — and was charged with engaging in a criminal sex act with an inmate last year.

Trail pleaded guilty to the charge in November.

In addition to his months in jail, Trail will have to register as a sex offender.