The names and attributes of Allah do not contradict; rather, they verify each other and some reflect others. Therefore, the implication of His mercy is mercy, and the implication of His justice is justice.
So, if someone says, "It is necessary for the disbeliever to be shown mercy because He is the Most Merciful of those who show mercy," then it is necessary for Him not to show justice, as justice is His attribute. Allah says in the Quran, "Or do those who commit evils think We will make them like those who have believed and done righteous deeds - [make them] equal in their life and their death? Evil is that which they judge." (Surah Al-Jathiyah 45:21) And He also says, "Or do We treat those who believe and do righteous deeds like corrupters in the land? Or do We make those who fear Allah like the wicked?" (Surah Sad 38:28) And He says, "Then did We make the Muslims like the criminals? What is [the matter] with you? How do you judge?" (Surah Al-Qalam 68:35-36) Therefore, it is from the complete wisdom and justice of Allah to distinguish between His ally and His enemy, the people of obedience and the people of disobedience, His slaves and the slaves of others. Otherwise, treating them all equally would be unjust and against wisdom. If the creation does not treat its enemies and allies equally, and that is considered foolish and unjust by people's minds and customs, then how about Allah, the Lord of the worlds, the Most Glorious?
"Allah, the Most Merciful, created the creation, provided for them, and bestowed upon them countless blessings. Then He sent messengers to them, revealed the books, and guided them to the clear evidence of faith and the sign of guidance, which is undoubtedly far greater than a mother's mercy towards her child.
So, when the believer obeys Him, and the disbeliever disobeys Him, He refuses to treat them equally according to His wisdom, knowledge, justice, promise, and warning, and the disbeliever excludes himself from qualifying for this special mercy in the Hereafter.
And Allah said: (My punishment - I afflict with it whom I will, but My mercy encompasses all things. So, I will decree it [especially] for those who fear Me and give zakah and those who believe in Our verses) (Al-A'raf: 156).
And God Almighty said: (Indeed, the mercy of God is near to the doers of good) (Al-A'raf: 56).
Ibn Al-Jawzi, may Allah have mercy on him, said: "Out of His general mercy is the sending of messengers and the granting of respite to the sinners. But if the disbeliever rejects it, he moves to the position of defiance and is not deserving of mercy.
As for His specific mercy, it is for His believing servants. He shows compassion to them in hardship and in ease, even greater than a mother's compassion for her child" (End of "Kashf Al-Mushkil" [1/94]).
The result is that Allah's special mercy in the Hereafter is only for His allies and beloved ones among the people of monotheism. As for those who die in disbelief, defiant and arrogant, they have no share in Allah's mercy and will be subject to His justice. The word of your Lord has been fulfilled in truth and justice, and what the disbelievers used to deny and mock has come to pass."