I received admission to a Ph.D. offer in the US with an assistantship that would cover my tuition and living expenses for Fall 2021. At the same time, I received a 10 days consultancy contract with the WBG to be completed by the end of June 2021. This consultancy contract may be extended based on performance and needs. Now, I have always wanted to work for the WBG, but I am very confused whether I move on and accept the PhD offer while doing the 10 days, then withdraw from the Ph.D. if am offered a longer contract. Or, I just move on with the Ph.D. because contract extension is not really guaranteed. Bear in mind that I am an international student and I need to start the visa process to move to the US by fall. What can I do? Is it ok to withdraw from a Ph.D. after accepting the offer and before starting the classes?
In the US, you can withdraw at any time, even after starting. If you have signed a contract for some services, then you may have to deal with that, but most universities will let it go since those services can almost always be handled by other people.
People leave doctoral education for lots of reasons.
But I suggest you think long term about your career and whether a job is preferable to a doctorate.
Bear in mind that I am an international student and I need to start the visa process to move to the US by fall. What can I do? Is it ok to withdraw from a Ph.D. after accepting the offer and before starting the classes?
That is the tricky part. Depending on circumstances, your visa may be linked to the PhD, it may even be a visa that prevent you from working. Too many unknowns to give you a specific answer.