Deductions & credits

After it opened back up, no.  It doesn't matter if they chose to go or not; they were paying for the membership to go.   If they wanted it to be a charitable donation, they could have stopped their membership and made an actual donation.

 

 

As for when it was closed, the Washington DC branch of the Y says they are applying it as a donation:

 

All membership payments made while the YMCA was closed will be recognized as tax-deductible charitable contributions to the YMCA.

https://www.ymcadc.org/faqs/