I am not sure of the mechanism it could use or even how something can make a 100% reliable predication-but like I repeat these facets are taken for granted. Perhaps Allah is infinitely aware of his creation, so he can understand the mechanisms of decision making with the genes & environment he gave us. Perhaps he can time travel or something like that. This would enable him to see what you did with your free-will.
As I see it there are two main ways in which God could be omniscient, and thereby, know exactly what actions we are going to perform, to the extent that God knew whether we were going to end up in heaven or in hell from the moment he created us, as stated in the Qur'an:
God as omniscient and bound by time, or God as omniscient but not bound by time.
The conception of God that is bound by time is the one who knows our future by making "predictions". And if this God is omniscient his predictions must be 100% correct.
The conception of God that is not bound by time makes no prediction at all. This kind of God is capable of time travel, or more conveniently for him, has all of space and time laid out in his presence to watch over. This kind of God knows our future actions because he can see us committing them all in his presence, all at once.
How does the God that is bound by time come to predict the future with 100% accuracy? You asked, what is the mechanism behind it? Good question. He can make a prediction that is 100% correct if and only if he knows of a law governing all events and occurences and which is therefore guiding those events and occurences to take one and only one particular direction. If he can predict all of our future actions, then we must also be subject to some law of nature, just as all objects are subject to the law of gravity, for instance. God has therefore used that law to calculate what future actions we are going to commit. But if our actions, intentions and decisions are all subject to a law of nature, our direction has been determined and we have no free choice in the matter. Therefore, free will is incompatible with this type of divine omniscience.
What about the God who can see all of time and space in front of him? Let's take the past: We can't change the past because it has already happened. Therefore, it's not within our power to change things that have already happened. If an event has been witnessed or observed, then it has already happened. God has witnessed and observed all of our actions. Therefore, all of our actions have already happened. But we have no free choice in the matter of changing things that have already happened. And so free will is incompatible with this type of divine omniscience, also.
Do you still think human free will can be reconciled with God's omniscience?