God can make mistakes if He wants to, but He does not make mistakes because making a mistake is an ungodly act. The Qur’an says:
"…my Lord never errs." [Holy Qur’an 20:52]
The moment God makes a mistake, he ceases to be God.
God does not forget:
God can forget if He wants to. But God does not forget anything because forgetting is an ungodly act, which reeks of human limitations and failings. The Qur’an says:
"…my Lord never errs, nor forgets." [Al-Qur’an 20:52]