Have you ever made a mistake bad enough that you have quit your job abruptly?
HOW TO TELL YOUR BOSS YOU BURNED THE BUSINESS DOWN
Ok, that is one strategy. Tell your boss something 10x worse then what you did so when you share your mistake it doesn’t seem so bad.
Unless it’s a crime no matter how big of a mistake it is you will get over it. Just come clean fast to your supervisor, offer to resign but tell them you know what you did wrong and that it will not happen again. Shut up and let them make the decision.