Aristotle’s theory was a little more nuanced.  He’s aware of art’s ability to influence, but he argues that it’s not depiction that is of chief importance, but portrayal.  I’m oversimplifying a bit here, but basically the artist can depict good people or things or bad people or things, and can portray them as good or bad, or leading to good or bad outcomes.  If a good thing is made to look good, or a bad thing is made to look bad, that’s morally correct.  There’s nothing wrong with depicting vice provided that the vicious do not flourish as a result of vice. The essence of tragedy, conversely, is when a basically good person meets a bad end due to some weakness or character flaw.   What would be morally bad, on this theory, would be when the artist makes the noble appear base or the subject of mockery, or makes the vicious flourish.  So a story about a racist character isn’t per se bad – if the character learns why racism is bad and rejects it, the story is morally edifying.

Source: What Art Scolds, Whether Conservative or Woke, Have in Common | Radical Classical Liberals