There are many ways to answer what seems to be a contradiction with Providence and Free-will.
One of them is known as the Molinist solution advanced by Luis de Molina back in the 16th century.
Now books are written explaining this subject but If I will attempt to summarize this in few words for you below.
The core idea of this solution is there exists truths known as counterfactuals of creaturely freedom. A truth of this form would be
Proposition 1: “If John was in the bookstore today he would freely choose to buy a book on Molinism”
If such truths exist, since God knows all truths, he would know every such truth about you and me. So prior to creating the world, he evaluates all these truths and picks the world that brings about the salvation of each and every possible creature who would “freely” choose to accept his grace and be saved. Then he creates that world and since he planned it, God already knows every single move.
Now one might say, is it possible that such truths exist in the first place?
I would think they do. In the homily by Pope Benedict XVI in his inaugural mass as Pope, he said
"We are not some casual and meaningless product of evolution. Each of us is the result of a thought of God"
I think this says something profound. God knows us so well because we used to be a thought of God. God in his love for us, decided to bring about our existence. As writers, we sometimes long to bring about the existence of fictional characters we have in our thoughts. But we can only do it in limited ways through fictional stories. God just did it perfectly. He brought us in to existence. So he knows our deepest longing. He knows us so well that he knows what we will choose freely.
Now it is true that some of these persons, would freely choose to reject him no matter which situation God puts them in. God knows this before hand too. But since he loves all of us, regardless of our answer to him, he creates them as well.
So in this sense God does not predestine the damned. He still gives them all the graces but they reject them freely and in doing so go to hell. But for the ones who he knows will freely choose him, he gives them all the graces to predestine them to heaven.
In the end, it is not human efforts that takes a person to heaven. It is God who has given the graces for the persons to make the effort to do good works and be successful in the effort to do his will. This is why we say that we are saved by God’s grace alone through faith and works.