This question totally depends on the intention of the author. If the author is using the racism text in a formal, non biased way, and is intending to teach the audience, then I believe it is valid. However, if the author starts to bring their own opinions and thoughts on racism, then it should not be allowed. Authors should only try to use racist language if they are attempting to impact the reader. For an example, If the author is writing a book on Nelson Mandela, and how he rose to power, then the author is educating the reader. They Seek for the audience to learn something about an a real event, Explaining how Mandela struggled against racist remarks he received and how he was African American. But, if the author is acting derogatory towards the matter, aiming to input their own opinions, then this is something called being bias. Where one individual feels the need to cause or show inclination or prejudice for or against someone or something.
In the end, racist language should only be used if the language is a true statement or an example of Historical Significance.
Example of racism in educational format:
“He told me today that After being arrested, African-Americans are 33% more likely than whites to be detained while facing a felony trial in New York.”
Example of racism in a derogatory format:
“That man over there seemed very strange. The colour of his skin made him look very sketchy”