Some people might struggle with psychopathy, but they are still given the intellect to know right from wrong. For example, when referring to the pharaoh (who was a psychopath), the Qur’an confirms that he was certain of the truth, and he knew he was committing injustice, but he did not care.
If a person is mentally impaired to the point where they don’t have the capacity to know right from wrong, then if they oppress others they will not held be accountable. Allah might either forgive them or retest them on the Day of Judgment. But if they know that what they do is wrong, then Allah will hold them accountable.