That depends on how you setup the Basic Authentication to begin with, I don’t have a generalized answer for you.
You could try something like this to make
location /.well-known/acme-challenge {
root /var/www/html;
auth_basic off;
}
but it’s just a guess.