By default, Magento 2 does not offer built-in options to sort products by stock quantity or stock availability. However, you can achieve this functionality by utilizing the Mirasvit Improved Sorting extension.
This extension, among many other sorting possibilities, provides the ability to sort products by stock quantity (regular or MSI) and by stock status. It can also be used to push out-of-stock products to the end of the product list.