Here are some recommendations for your present situation, along with a suggestion to avoid this problem in the future.
1. It is not required that a property be brought up to the current Building Code. It simply must comply with the Code as of the date it was constructed--which is defined as when the Certificate of Occupancy was issued.
2. Carefully review the provisions in the INSPECTION/REPAIRS section of the Contract. In North Carolina, the items being inspected are spelled out very specifically. You also will see that the "acid test" is that an item or system "must be performing the function for which it was intended and is not in need of immediate repair". Your contractor's estimate should be written from this perspective. Other "improvements" he finds do not count toward the $4,000.
3. Consult with an attorney. With $4,000 at risk, an hour of a lawyer's time is very inexpensive by comparison. Ditto for filing an action in Small Claims Court (and paying the small extra fee to have the papers delivered by a Deputy Sheriff, which is a nice theatrical touch--Grin.) But first, see if the lawyer will write a demand letter on his/her letterhead.
So, how do you avoid this problem in the future? Simple. Use Alternative 2, instead of Alternative 1. You pay a small, non-refundable Option Fee. This gives you the right to inspect ANY aspect of the property (instead of only the systems outlined in Alternative 1). Equally important is your right, prior to the end of the Option Period, to withdraw the contract "for any reason, or no reason". In other words, you simply state that you are withdrawing. You do not need to specify why. (But, If you decide to continue with the transaction, the Option Fee is a credit to you, on the closing statement.)
Can the Seller refuse to return the Earnest Money under Alternative 2? Not if you are my client. It is my standard of practice not to turn over the Earnest Money until the end of the Option Period. The Seller can't lock it up, because it never was tendered. [Chuckle]
Say, that's pretty good for an agent's first day on the job, eh? Just kidding, of course. After twenty-three years in this profession, I've developed some techniques which bring some sanity to the practice of real estate brokerage. And I hope what I've written here is helpful.