Why did God test Abraham’s loyalty by asking him to sacrifice Isaac? It is not consistent since God knows everything about us and even our intentions. Do you not think it is absurd to ask for something from Abraham if we assume that God knew beforehand how faithful it was Abraham?
This is a good question. I just finished reading a book I would recommend on this topic. It is Paul Copan’s "Is God a Moral Monster?" Quite a provocative title! Here he refutes the spurious claims of Dawkins, Hitchens and others that the God of the Old Testament is evil.
With that introduction, your question is a good one. It seems, at least at first glance, that God’s request to Abraham was unreasonable and possibly even cruel. What a horrifying test he put Abraham through, one might ask. Here is how I see this. This was not a test of loyalty, but of faith. In the New Testament (and in the Old Testament) Abraham is the penultimate example of a person of faith. Romans chapter 4 describes Abraham, in his faith, as the father of all who are saved by faith. The testing of Abraham (and of Isaac as well, by the way) is a prophetic foreshadow of what God the Father asked God the Son–Jesus–to do. Abraham was asked to sacrifice his one and only son, just like God sacrificed his one and only son. The place of the sacrifice was Mount Moriah, which is most likely the exact same mountain where Jerusalem is built. The prophetic implication is great. Abraham received his son back from "the dead" on the third day. Isaac, like Jesus, carried the wood up Mt. Moriah which was to be used for the sacrifice.
Was this an astounding request? Yes. Did it require an almost superhuman amount of faith for Abraham to complete the task? Yes. But that is the point. If you look at Hebrews 11:17-19 it offers a useful commentary on this test of Abraham. Here we see that Abraham reasoned in his mind that God could raise Isaac from the dead. Abraham’s faith was so great that he trusted God’s promise that a great nation would be built through Isaac, even in the face of what appears to be a terrible request. God honored the faith of Abraham. He provided a ram for the sacrifice. As promised, a great nation arose from the seed of Isaac, and in the end the Messiah came through that seed. What an awesome plan.
Now, I am not God, and I am not in a position to make any sort of request even remotely like what God asked Abraham. However, you raise a good point about God’s foreknowledge. God knew what Abraham would do. He had absolutely no intention of letting Abraham kill Isaac. God does not force our decisions. God does not remove our free will, but God is omniscient. God knows what will happens before it happens. God predestined Jesus to die on the cross. God knew that his Son would rise from the dead. He foreshadowed this in the events surrounding the request for Abraham to offer up his son.
From our human perspective, living in a universe in which time is a linear thing, it is hard to understand how God can foreknow something and not predetermine it, but God is not subject to our limitations. No, it is not absurd for God to ask something of Abraham when, in principle, he knows the answer. For us humans in a linear time situation, it is hard to think about this, but God exists outside of time and God gives us free will. We are not his puppets. God’s plan was to bless all nations through the man of faith: Abraham. Biblically, our faith is proven by our deeds (James 2:14-26) and Abraham is no exception to this rule. Personally, I like this plan. I am inspired by the faith of Abraham, and I am encouraged by God’s willingness to justify Abraham by faith. Like James said, "Abraham believed God and it was credited to him as righteousness."
In conclusion, I can definitely see why you find this potentially confusing. Why would God ask a person to do something to prove the faith which God already knew he had? I believe it is us, not God, who need proof of our faith. However, we complete our faith by what we do and from a human perspective, this makes perfect sense.