You can control whether out of stock items show or not within the Shopify Algolia extension.
Algolia App > Search options > Out of stock items
This setting will prevent them from showing on your site. You can check out more information about the details here: https://www.algolia.com/doc/integration/shopify/going-further/out-of-stock-products/?client=ruby