You will probably lose it.
When you file for bankruptcy, your bankruptcy attorney applies various exemptions (protections) to your personal property. If you have a 401k, or most retirement plans, your attorney can exempt that asset so that a bankruptcy trustee won’t see any value in it. ESPP’s are different.
An ESPP is simply a perk with some employers, where you are allowed to purchase stock in the company you work for. Unfortunately, this stock is not an exempt asset in bankruptcy. It is not a retirement plan. It is simply a piece of paper (stock) with real value if the trustee decides to sell it off. It is the same as a pile of cash sitting on your kitchen table.
So, if you file a chapter 7 case, there is a good chance that the trustee will order you to sell off the stock, give the money to him, and he will pay that money to your creditors. If there is less than $2,000 in it, he will probably leave it alone unless you have other assets, like a huge tax refund or too much equity in your cars.
If you file a chapter 13, the chapter 13 trustee will demand that you pay the value of your ESPP to your creditors. He will not order you to sell it off. So, if your ESPP is worth $2400, you will pay an extra $40 per month during your chapter 13 plan ($2400 /60 months = $40/month).