Locate the method \Amasty\Sorting\Model\ResourceModel\Method\Instock::apply()
.
Replace the line
'stock_status_index.qty > ' . $this->helper->getQtyOutStock() . ' OR e.type_id in (' . implode(
to
sprintf('stock_status_index.%s > ',
\Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Module\Manager::class)
->isEnabled('Magento_Inventory')
? 'quantity' : 'qty'
)
. $this->helper->getQtyOutStock() . ' OR e.type_id in (' . implode(