I received an offer from company A and accepted it. In the mean time, a job was posted from company B which is my dream company and I applied. I haven't signed the contract with company A. Should I go ahead and sign the contract with A, go to an interview with B and leave A in case I get accepted at B, or tell company A I cannot sign the contract and wait for company B to call for an interview. I am currently employed. Any advice is welcome.
Don't count your chickens before they hatch
Since your application with B has not even progressed to the shortlisting stage yet, it doesn't make any sense to put A on hold. You don't even know how much time it could take before B gives you a final answer. You may end up alienating the recruiter from A, and they may even withdraw the offer if you don't accept to join by given date.
So at best, you should ensure that A doesn't have any lock-in clauses in their offer, so that if B were to make you an offer, you can join without problems.