Racism is not, strictly speaking, mental illness. It's brainwashing. But, I believe racism is insanity.
We know that brainwashing damages the brainwashed, tearing down the walls of their reason and sanity. People rescued after brainwashing are left with deep emotional scars and, sadly, often a propensity for falling back down the rabbit hole.
I also believe that the things racists do twists their minds and bends their sanity. The racist starts down a path of cruelty that carves away sanity from their thinking and behavior.