It runs from a VFD?
Many VFDs have 1 or 2 output relays.
You can program one of them to use the closed contacts only when the spindle is stopped.
Use NC contacts, when stopped. Program so that when above, say 20RPM the relay operates and contact opens.
The 20 is not your programmed speed but the actual commanded speed, internally within the VFD as it ramps down/up
Super X3. 3600rpm. Sheridan 6"x24" Lathe + more. Three ways to fix things: The right way, the other way, and maybe your way, which is possibly a faster wrong way.