You can use like this in list.phtml:-
$cart = $objectManager->get('\Magento\Checkout\Model\Session')->getQuote();
$result = $cart->getAllVisibleItems();
$itemsIds = array();
foreach ($result as $cartItem) {
array_push($itemsIds, $cartItem->getProduct()->getId());
}
print_r(in_array($productId, $itemsIds));
As an alternative you can also use Magento default feature:-
For individual settings, go to product details
Click Advanced Inventory
Maximum allowed inventory, and make it 1