Let's start from the point that "artificial intelligence" is a consumer-friendly name for "algorithmic analysis" because that is what it is.
Who defines those algorithms? Humans do. So when "artificial intelligence" fails, it's because humans have failed.
The quality of the algorithms depends entirely on the capability and the discriminations of those who build them, whether those discriminations be deliberate or "unconscious."