To naturally rid your soil of nematodes, which are soil-dwelling pests that can hurt tomatoes and potatoes, use marigolds.
The chemicals released by the marigolds' roots and decaying leaves is toxic to nematodes. https://antiagingtreat.com/botox/botoxnorisk/comment-page-25/