A Heart Conducive to Understanding
Before addressing the question, it seems appropriate to address the proper spirit in which such answers should be sought. There is a very important principle in Scripture which we need to remember;
You will say to me then, “Why does [God] still find fault? For who resists His will?” On the contrary, who are you, O man, who answers back to God? -Romans 9:19-20
It is inappropriate to critique God, or to accuse Him of injustice or trickery. Furthermore, it will not lead to understanding, as the following verse explains:
A scoffer seeks wisdom and finds none, But knowledge is easy to one who has understanding. -Proverbs 14:6
To learn the answers to such difficult questions, we need to seek the Lord.
Evil men do not understand justice, But those who seek the LORD understand all things. -Proverbs 28:5
What We Know About God
When we seek answers about the tough subjects of Scripture, it is important to start with what we know.
The first thing to recognize up front is that God is good. Everything good was created by God, and everything created by God is good. To say it another way, God did not (and cannot) "create evil." (I'll answer the obvious questions in a moment.)
Secondly, it is clear from Scripture that God would do anything for His people. He made salvation available to everyone, and He desires that everyone would be saved. So it would be severely inappropriate to think that God would put a stumbling block before Adam, tempting him to fail - all for the purpose of personal benefit. That doctrine is severely inconsistent with Scripture.
At this point, many wonder, "If God didn't create evil, then why does evil exist?" I think we need to be careful with semantics here. Evil is not a substance to be created or destroyed - it is a way which is contrary to God's ways. For instance, if I become conceited, that would be evil (sin) because that is contrary to God's good ways (love, humility, etc.) But it wouldn't really make sense to ask "Why did God decide to create my conceitedness?" because it obviously isn't a substance to be created, and if it were, He obviously wouldn't have created it. Evil only sounds like a substance due to clever wordplay.
What God did is speak a perfect, good creation into existence, complete with beings who have the capacity to love and receive love. Obviously love involves choice, so men were created with a capacity to willingly love Him.
Why The Tree?
God created man with the capacity to choose to love God and walk in His good ways. That would be absolutely pointless if man was never presented with an opportunity to make a choice of any kind!
Enter "the tree." When we're talking about the forbidden fruit, we really need to take a moment and reflect on the situation prior to Genesis 3. God has just created an entire "very good" universe and essentially handed it all over to man. He made celestial objects for signs and seasons, filled an entire planet with creatures and plants, and prepared a paradise garden to walk with them in. There was one thing they weren't allowed to do. One rule. One little ol' tree in the middle of the whole big creation which they were told not to eat from. We're not talking about the Levitical Law here... this was a pretty reasonable boundary! Let us keep this in mind as we continue.
As I mentioned, the tree provided them with an opportunity to choose. With this one tree being off-limits, they now had an awareness of "right and wrong." Make no mistake - they knew it was wrong to eat the fruit - God made that very clear. That is not to say that they "knew" (had a personal experiential understanding of) evil; just that they "knew" (had the knowledge of) right and wrong.
Q & A
"If the fruit was 'forbidden', why did God put it in front of man?" Answer: "Forbidden" means it was a boundary which God set. He could have chosen any boundary He wanted - He could have said "don't stand over there." He chose the fruit, hence "forbidden" fruit. (Why did He choose the fruit? That's another question!)
"If God wanted Adam in Eden, why did he keep the fruit there?" Answer: The tree represented the choice which made willing love possible. The proximity allowed them a continual choice, which made continual love possible. It's not that God planted "temptation" and "wickedness" before man's eyes, but rather, that He planted "a choice" in their midst.
"Why was it necessary to present Adam with a test which he was bound to fail?" Answer: This question is based on a misunderstanding. Adam had a choice, and chose to sin. The idea that he was "bound to fail the test" is false. (Consider the angels - some fell, some did not.)
"Who knew better than God that Adam would fail the test?" Answer: This line of reasoning assumes that foreknowledge necessitates fatalism, and eliminates accountability. Both assumptions are false. Yes, God knew what Adam would choose - but it was Adam who chose.
"If God wanted Adam to fall, why was it necessary to trick him first?" Answer: The premise of this question is a false assumption. God didn't want Adam to fall. Also, God didn't trick him.
Hope that helps!