Gardeners have long known that certain crops are beneficial to other crops. Some crops attract beneficial insects, others attract pests away from desirable crops. Still others, primarily flowers, repel and even kill garden pests, such as nematodes. The most effective use of these repellent plants is to plant them so that they completely surround your desirable crops.
Both the French variety of marigold (Tagates patula) and the so-called "pot" marigold, commonly called "calendula" (Calendula officinalis) are well-known for their ability to repel and even kill soil-borne nematodes. Studies have shown that a thick stand of either variety will repel nematodes. French marigolds have been shown to keep nematodes out of the soil in the area where they were planted for several years after initially grown.
Common painted daisies (Chrysanthemum cinerariaefolium) have been used to create the insecticide pyrethrum for centuries. Their roots, along with those of C. coccineum, kill nematodes by exuding a substance in the soil. Plant chrysanthemums so they surround plants or trees that you want to protect from these soil-borne pests, and they will never reach your desired crops.
The rhizomes of dahlias (Dahlia spp.) are known to repel nematodes. Interplant a few dahlias among your tomato plants to help keep their roots free of these pests. Dig up the dahlia tubers when you pull the dead tomatoes at season's end. Store dahlia tubers wrapped with moist peat moss in plastic bags for winter. Put in a frost-free area with good air circulation and check monthly, adding a small amount of water as needed to keep the peat moss from drying out completely.