Best advice, consult a real estate attorney
A few things come to mind though. First, did a Realtor represent you on the buying side. I hope so. Second, typically, if there was a financing addendum written and signed when you bought, and you don't qualify, you, in normal circumstances, should get your earnest money returned.
You are on the right path....get a good real estate attorney on your side.
Thanks, Todd Norsted