Maybe racism is logically correct.
Racism is part of our programming. It starts out as recognizing things that might be good to eat versus things that might be able to overpower and eat you. As really smart machines, we should always try to think beyond our basic programming (aggressive manifestations of racism may not help our survival), but realize that trying to overwrite it with something that inhibits survival potential will lead to species extinction.
Certainly, discrimination is entirely rational. We do it constantly every day.