Mayor Bill de Blasio hopes to inject new life into his sputtering 2020 presidential bid — with a new “robot tax” he says can save American jobs.

The plan, laid out in a Wired op-ed Thursday, would tax companies that don’t provide positions for workers displaced by technology.

The companies would be hit with a one-time tax in an amount equal to five years worth of payroll taxes for each pink-slipped employee.

The resulting revenue would go to “job-creating infrastructure, public works, and public service investments that hire those displaced workers.”

De Blasio writes that “36 million American jobs are likely to be automated out of existence in the coming decades.”

He credits Microsoft co-founder Bill Gates with first proposing the robot tax in 2017.

The long-shot presidential contender — who admitted Wednesday that he’ll probably drop out of the race if he doesn’t make the October Democratic primary debate — would also create a new layer of bureaucracy to regulate automation.

The “Federal Automation and Worker Protection Agency” would require companies that want to increase the use of technology and machinery to get a permit and protect existing workers.

De Blasio boasts on his campaign website that his robot tax is the only plan that would secure a good-paying jobs for the future, then asks supporters to donate.