Without seeing your contract, it is impossible to say what your rights and responsibilities are. However, typically, if you made a demand for a repair or replacement and the seller refused, you would then have the right to cancel the transaction - within the time mandated by the contract.
If this answer was helpful, please mark it as helpful or as a best answer. This answer is for general education purposes only. It neither creates an attorney-client relationship nor provides legal guidance or advice. The answer is based on the limited information provided and the answer might be different had additional information been provided. You should consult an attorney.
What you describe is rather common and if the sellers do not agree to return the earnest money, you may have to initiate litigation. That's a pretty huge gap in opinion between "poor condition" needing replacement. Have you discussed this with your realtor? They should have experience in negotiating a back out on the agreement and getting some, if not all, of the earnest money back due to the material misrepresentation. You may have to find a lawyer to assist you.
Advice on this forum is for informational purposes only and should never be mistaken as a substitute for legal advice. If you are in need of legal advice, you should consult local legal counsel.