Hello,
Unfortunately, this is not possible to hide “out of stock” products from related products section. Feel free to ask if you have any other questions.
Regards