How do I hide out of stock products from homepage but not from catalog?

Assuming you are using storefront default homepage template. You can filter products before displaying on hompepage

function rfl_show_backorders( $is_visible, $id ) {
    $product = new wC_Product( $id );

    if ( ! $product->is_in_stock() && ! $product->backorders_allowed() && is_front_page() ) {
        $is_visible = false;
    }

    return $is_visible;
}
add_filter( 'woocommerce_product_is_visible', 'rfl_show_backorders', 10, 2 );