Depends on how it was hacked.
Generally:
1. Restore boot1/boot0 using hekate - to reverse autorcm - assuming V1 and needs a dongle to power on
2. Remove SD card and keep it
3. Boot normally
4. Turn on wifi to free up the linked account (optional)
5. Erase/format all data on the switch using the...