Don't fully qualify for Roth IRA, but investment lost significant value

For 2021, I don't fully qualify for a Roth IRA, $1530 of the $6000 contribution needs to be withdrawn before the due date of my return. However, that investment has lost over $4000 so I'm trying to determine if I do need to withdraw $1530, or how much to withdraw, and if there is a way to keep my cost basis.