Why did God create us with free will if he knew we were going to sin against him?
We might reasonably suppose that as God’s long-term purpose is to live within and with his creation, He doesn’t want robots. He wants men and women who, given the choice, value and appreciate his love and choose to love him in return.
God created the earth to be inhabited. Isaiah 45:18
His purpose is to fill the earth with his Glory. Numbers 14:21
His glory in the earth will be in the form of men and women raised to the divine nature in whom, and with whom, God will live forever. 2 Peter 1:4
The love of God gives us a purpose in life, a goal worth striving for. We value those things most that we have expended energy for.
The culmination of God’s purpose is prophesied in Revelation: Revelation 21:3,4
We are not in a position to question God, but should rather be grateful for the opportunity to choose life. Romans 9:20
I hope you find this helpful.