A common argument against free will is to claim that if God knows every choice before it's made, it wasn't truly free. This argument is flawed for a number of reasons.
The first reason it is flawed is that even a predictable choice is still a choice. We in the present may actually know a lot of choices before they are made. Before the pandemic struck Britain and everything closed, I was so predictable that my favorite cafe even had a button programmed into the till just for me. They knew what I wanted before I walked in the door (and by the same reasoning, they knew when I would walk in the door). But in spite of their knowledge of what I would choose, I was not compelled to make this choice, even by their knowledge. I was free to make another choice.
But obviously, God isn't just some smart cookie who knows your interests and desires. Rather, He knows what you will choose even if it isn't especially predictable what you will choose. There are two reasons for this, the first being that God is omniscient. But aside from this, God is beyond time. Our past, present, and future, are all in His sight at any given time.
Now, needless to say, free will does not include the ability to choose our past. When a choice is made, it cannot be taken back. But it can be chosen before it is made. To illustrate this, I want you to imagine you are a phantom time traveller. You are able to travel back in time, but with no ability to affect change. So, you travel to a time you remember well, and you observe your own past self. With your hindsight, you know every event that will occur at this moment. Let's just pretend your friend asked you to be their valentine.
Now, you're a time traveller. You're watching the question being asked, and you know exactly what your past self will answer. Not only do you know if you said yes or no, you remember every word you used. Does your knowledge of those choices affect that choice? The obvious answer is no, of course not. At the time, you chose freely. The memory your present self has did not change the past.
God, being outside of time, is effectively a time traveller. His knowledge of our choices do not affect those choices. In fact, put simply, the only reason He knows our choices is because we make them. If we make another choice, He would know that instead. His knowledge doesn't affect the choice, the choice affects His knowledge.
This can be clearly seen in Jeremiah 26:3, where God suggests that the people might actually hear His words and repent. Obviously in His omniscience, He knew that they wouldn't, but He also knew that they could. Thus, we see that choice is not affected by God's foreknowledge. Free will and foreknowledge are entirely compatible.