God knows, before even creating Earth, which people would choose Him on Earth and eventually go to Heaven. Therefore, God could just create these people and choose not to create the people who will go to Hell.
Furthermore, because God is all-powerful, He could instantly implant all the spiritual growth, experiences, knowledge, etc. that these people would have gotten on Earth into their minds in Heaven - making the need for the experience/journey we go through on Earth unnecessary.
Therefore, why would God create Earth as a "testing phase" for humans to grow, learn, and choose Him, when He can already have Heaven now with free humans that will love and serve Him? He could bypass all the suffering and evil in the world by doing this and achieve the same end result - a Heaven where all the people, of their own free will, love Him, serve Him, and share in His beautiful creation.