Yes, God knew they would sin; He knew they would fail the test. But did He want them to fail? No.
But my opinion is God did plan that to show us something about our own selves . . . so we can see our need for Christ on the cross and in His resurrection. He did not want them to fail, but He does want us to learn from their failure . . . to see how we need Him and can not afford to depend on our own selves > if Adam and Eve were perfect creatures and they failed . . . I consider this fair warning for us not to trust how we ourselves can do things.
This is an example of using evil for His good purpose, by the way. You did ask for examples of God using evil for His good purpose. And, like I offered, in the process, He can put an end to the evil while bringing His good result.
For us personally, this can mean God is able to change our character so we do not give in to Satan, becoming more like Jesus who never has given in to evil. But, also, like I say, with Jesus we can also be doing what is so good, not only struggling all the time to resist temptation. So, we not only need wisdom and strength to say no to Satan, but also we need to live in our Creator's love (Romans 5:5, Jude 20-21) so we become creative in how to love any person.
This is what God wants. Plus, you could say, He wants failure to be temporary, then
So, saying He wanted Adam and Eve to fail and sin might be argued, since He did not stop that from happening and could have, but what He really wants, in any case, is we learn from that and do not keep on failing and sinning, plus He wants us to come out like Jesus and to love like Jesus.
But, of course, you have already asked, why didn't God just start us off being like Jesus? Yes, I can see the point . . . that that could be more direct. And this is the question of this thread
And I have already offered a little about this.
In my opinion . . . I have learned . . . God is the Creator of all, and He is all-controlling, not only all-knowing and all-powerful and everywhere-present. So, when you ask me this, you are asking why God in His all-control would decide that Adam and Eve would fail so?
And what I have learned is . . . of course, subject to evaluation >
One thing is that, all along, God intended for Jesus to be the first perfect on this earth. And I understand that Jesus is perfectly like our Father who is incapable of sin and evil > James 1:13. But yes we have ones very in disagreement with this, and they can use the Bible to argue that Jesus was indeed capable of sinning
In any case, what I understand is that ones becoming perfected would do so in coordination and unity with Jesus being the first of the perfect. God wants us in unity plus coordination with Jesus who is our first and example-and-sample; He does not want a bunch of isolated independent "Gods", but growing as one body of Jesus . . . in family caring and sharing intimacy.
So, Adam and Eve never were meant to be the first to live without sin on this earth.
Still . . . why?
My opinion is God wants to have a place for evil, sorted out from His children who will eventually be on this earth once it is resurrected > Romans 8:20-21 >
"For the creation was subjected to futility, not willingly, but because of Him who subjected it in hope; because the creation itself also will be delivered from the bondage of corruption into the glorious liberty of the children of God." (Romans 8:21-22)
So, evil on this earth is in a holding place, and there are humans actually volunteering to have it in them . . . while it is on its way to the flaming sewer which burns with fire and brimstone. So, these buckets of the sewage of evil's things are doing a very important job.
So, what is wise is to make sure we are not dishonorable vessels of unforgiveness and hate and discrimination and lusts and frustration and stress and abusive sorts of arguing and complaining which degrade people from how love has us becoming and sharing with Jesus, instead.
Now, does God want people to be buckets of Satanic stuff? I would say no. But I see how it is practical, keeping the spirit of evil (Ephesians 2:2) organized. And anyone in Jesus can grow in love, instead, even right in the middle of such a horrible mess of this evil world. Because God is superior and better and more powerful.