One solution is to feed mains to the PSU via the NO contacts of a relay. Also connect a mains-rated NO push button in parallel with the relay contacts. Connect the relay coil between the PS_ON output of the Duet and either +5V or +12V. Don't forget the flyback diode across the relay coil.
In config.g put command M80 near the start, to turn the relay on. To start the printer, press the push button and hold it until the relay turns on. Then you can use command M81 to turn the printer of. This can be done in your end gcode. Don't forget to put a G4 delay command before it, to allow the hot end fan to cool the hot end down first.
One disadvantage of this approach is that whenever you do a software reset, the printer will turn off.