How to protect wp-admin through .htaccess?

Basically, it should look like this:

AuthType     Basic
AuthName     NAME_THIS_THING
AuthUserFile PATH_TO_USER_FILE
<Files '*'>
    Require valid-user
</Files>
<Files 'admin-ajax.php'>
    Allow from all
    Satisfy any
</Files>

Replace the upper case parts with something real. admin-ajax.php is the only file that should be available without restriction.

The details of the user file are a little bit out of our scope, and they might depend on your operating system.