In the Purchase & Sale agreement under Item #17 is the paragraph that addresses what your recourse is in the event of an earnest money dispute. In this paragraph, both you and the seller have agreed to mediation to resolve the dispute over the earnest money, in accordance with the Maine Residential Real Estate Mediation Rules.
The link above will provide you with the information you need to initiate mediation. It is important to note that the brokerage holding the earnest money is obligated to retain the earnest money in its trust account until the dispute is resolved. That is to say, they can not (or should not) release it to either party in a dispute until the dispute is resolved. Unfortunately, the seller can indeed dispute the release of the earnest money, even though they may have no legal right to the money. Who has the legal right to the money is decided by the mediation process.
I'm sorry you have to go through this process. If your buyer agent is unable to resolve this issue with the seller's agent, you will have to initiate mediation to get your earnest money back.