Quote from Sour Lemon
It's all about options. If you have better ones, take them. If you don't ...
But either way, you need to actually read the contract before you decide. They say the devil is in the details, right?
I can't like this enough. They (generic, not directed specifically at OP) sign these contracts without giving it a thorough look, and then are surprised/angry that they can't break them without penalty. If you sign, you are saying to them, "I understand and agree."
That being said...
You can't plan based on a job that you "might" get. Until you get an OFFICIAL job offer from that organization's HR department, you don't have anything.
So you need to decide whether to:
1. Sign the contract and make the commitment. That locks you into two years, but it's a job. As a new grad, job opportunities can be tough to come by. And most of the time, that first job is for the experience more than anything else, because after you get that experience, you will have more opportunities available.
2. Pass on it and take your chances that you'll get hired elsewhere. Here, you're foregoing that guaranteed job in the hopes that you'll get this second one. Is that a wise move for you? I don't know, only you can answer that question. The thing to consider here is what will you do if you don't land that other job after all. And what is your local job market like for new grads: is it promising or do you see new grads taking several months or more to land something? Were you lucky to get this offer? It is worth the risk of losing it?
3. Sign but are willing to pay the penalty should that second job offer comes through. This gives you the security of having a new grad job, but should you want to leave for that second (or any other) job offer, you acknowledge that you'll have to pay a price to do so. Again, whether this is a good decision can only be answered by you. For some, the penalty may be worth it. For others...
Best of luck whatever you decide.