Did God know that if he put the tree there then the people would eat from it?
Did God have a choice to put that tree there?
Could God have made a world where they did not eat that fruit?
If he picked this possible world out of all possible worlds based on an outcome that he had in mind, then we’re just playing out the parts that he assigned for us.