Yesterday when the teacher said a student accused my son of teasing, my son really believed he was "playing" with the other student. Once again, he was very poor at knowing how to act in a social situation, reading body signals, knowing what is acceptable.
Maybe because he's on a different level intellectually, his sense of humor is also at another level. DS5 (and myself) doesn't realize how his sarcastic nature/sense of humor affects those around him, especially when they can't "see" the humor in his comments, etc.
As far as him allowing everyone to think he's racist, I think that's just what you said, a poor choice on his part and his attempt to find his spot without getting bullied or ridiculed or being the next "target" for the fights and taunting.
Keep encouraging him to be open and to be true to himself (even if he doesn't know what that is quite yet). I taught 5-8th grade boys PE several years ago, and it's amazing to see the different phases that boys especially go through at this age!
Good luck!