The New Jersey man who masterminded a plot to scam GoFundMe donors with a hoax story about his ex-girlfriend helping a homeless man pleaded guilty Friday and must now serve five years behind bars.

Mark D’Amico pleaded guilty in Burlington County court to state charges of misapplication of entrusted property.

As part of his plea deal, D’Amico agreed to a five-year jail sentence. His ultimate sentence could be higher; he is still facing additional, yet-resolved federal charges for the 2017 scam.

His accomplices — ex-girlfriend Katelyn McClure and homeless vet Johnny Bobbitt — have each pleaded guilty to state and federal charges for their roles in the scam. Bobbit was ordered to enter a drug rehab program, and McClure agreed to serve four years in prison as part of her plea deal.

McClure, 28, and D’Amico, 39, created a GoFundMe page in November 2017, claiming homeless drug addict Bobbitt spent his last $20 to fill up McClure’s empty gas tank after her car broke down on I-95 near Philadelphia.

The charity campaign exploded, raising tens of thousands of dollars from unsuspecting donors in a matter of days — and ultimately shooting up to more than $400,000.

Their plan began to unravel in August of this year, when Bobbitt sued the couple, claiming they were withholding funds raised on the GoFundMe from him.

With Post wires