Yes, password-protecting directories can affect how search engines interact with your site. When a directory is protected by a password, search engines like Google are unable to access, crawl, or index its contents. As a result, any pages within that protected directory will not appear in search engine results.
If you want to restrict access to certain content while still allowing it to be indexed, consider using alternative methods—such as a login page with controlled access—rather than password protecting the entire directory through cPanel or server settings.