Jesus’ foreknowledge that Judas would betray him (for example, Matthew 26:21-25) does not mean that Judas was chosen or forced to betray Jesus. There is a difference between foreknowledge and foreordaining. While the Lord knew what was going to happen, and while he was going to use that event for his plans, he did not force the event to take place.
I have these notes written down from a seminary class from years ago: “The foreknowledge of God does not bring necessity to the event. It only means God knows what is going to happen. As our memory of past events does not necessitate an event, so God’s knowledge of future events does not necessitate an event. Our knowledge of when the next lunar eclipse is going to take place does not make it happen. The foreknowledge depends on the event; the event does not depend on the foreknowledge.”
Finally, it is helpful to keep in mind how Jesus addressed Judas at the time of the betrayal: “Friend” (Matthew 26:50).