Q. Why did God allow Adam and Eve to eat of the fruit of the tree of the knowledge of good and evil?
A. Another way to state your question is this: Why did God make human beings with a free will, even though He knew they would abuse it?
Which is better: A world of robots who act only in accordance with God’s will because they are programmed to do so? Or a world of sons and daughters, made in His own image, who are free to love Him and one another, even if they sometimes fail to do so? I think that most of us would agree with God’s decision that the latter is the better kind of world, despite its problems.
As long as there exists in the world a free will other than God’s own, there exists the possibility of that will opposing His will, at least at the outset. (A human free will that chooses to love God is at last, after death, confirmed in that choice so that it can never choose against God again; but the final “ratification” of the will’s choice by God results from the will’s own free choice in the first place.)