The former chef of a raw food restaurant pleaded guilty to harassment Tuesday in Manhattan court for trying to pleasure himself in front of an alarmed straphanger as she waited for her train in the East Village.

Dan Hoyt, 54, the former chef and co-owner of the vegan eatery Quintessence, was sentenced to time served for the bizarre Jan. 12, 2016 incident.

“Can I masturbate to you?” the eccentric cook allegedly asked the 25-year-old woman on the N platform at Broadway and East 8th Street.

She hustled away from him as he dropped his pants and ogled her from behind a beam, court papers allege.

“We’re glad to put this one behind us,” said defense lawyer James Palumbo. But Hoyt isn’t in the clear yet. He still has an open case for two similar lewd acts against a 24-year-old woman.

“Hey, look over here,” he allegedly shouted at his victim as he stood with his pants around his knees pleasuring himself on the same N platform on New Year’s, the criminal complaint states.

The next day, the same woman spotted him inside a subway car completely naked from the waist down, masturbating, as he advanced toward her, the complaint says.

Hoyt was arrested in 2005 for allegedly committing the same crime against at least five women at the Columbus Circle 59th Street subway station.