Fixing fake rotation
To do that, set snapping on with these setting:



Then create an empty and move it on the face on the nut:



The empty now has the same orientation as the nut.

Parent the nut to the empty: select the nut then shift select the empty and CtrlP.

Now select the empty and remove its rotation using AltR.



The nut is well oriented.

Last steps, clear parent from the nut AltP with keep transforms and apply its rotation CrtlA then rotation.  

Note: if several objects have the same fake rotation, you can use the same process parenting them all to the empty.