Yes, you can include pre-petition HOA dues in a chapter 7 bankruptcy. However, dues that accrue post-bankruptcy would not be discharged in chapter 7. If, then, it takes the bank another three months to foreclose after you file bankruptcy, the HOA could still pursue you for the additional three months of HOA dues.
The foregoing is commentary regarding a general legal question. It is not intended to be legal advice specific to the reader's individual situation nor does it create an attorney-client relationship between the author and any reader. You are encouraged to contact a qualified attorney to discuss your legal situation.
I agree with the previous answer and would like to add: Have you attempted to do a deed in lieu of foreclosure? This would allow you to get the deed out of your name and to stop incurring more HOA fees which then, you would be able to file bankruptcy without worrying about incurring more HOA debt post petition.
You really should contact the lender and offer the deed in lieu of foreclosure. If they do not want it, get a renter in that will pay at least $400 a month to cover the dues, then file your bankruptcy to eliminate any that exist as of the day you file chapter 7.
Best if you can wait until after the foreclosure is complete and then file the chapter 7 as far as the HOA dues are concerned. HOA dues that become due and payable after a chapter 7 is filed but before the foreclosure is complete are something not includable in a bankruptcy and would be your responsibility to pay.