Sterilizing garden soil is easy through a few processes, which will ensure that you have quality dirt ready to use for the things you're going to grow. But to sterilize your garden soil, you are going to have to do a few things first to prep for sterilization.
Weeds are bad for plants and awful for soil, so remove them before sterilization because you don't need them, and if you find any other things that aren't soil, like bugs or garbage, remove them too because you'll only want the pure soil.
Place the soil in a container suitable for an oven and make sure the soil is spread evenly throughout the container's bottom so the soil is a few inches deep. Mix water into the soil just enough that all of it is wet, but not so much that it's drowning. Bake the soil in a preheated oven (200°F) until the temperature of the center of the soil reaches 180°F (use a meat thermometer to measure). Once the soil temperature reaches 180°F, bake for 30 minutes. Afterwards, leave the soil to slowly cool.
Similar to oven sterilization, you want to put moist soil in a microwave safe container that's only a couple inches deep, and turn your microwave onto high for several minutes. Since this is quick, you can do this a couple times to ensure your soil is properly sterilized. After each microwave session, be sure to let the soil cool down first.
This involves a longer process where you lay plastic sheets in area that gets heavy sun exposure all day, layer it with soil a few inches deep, then cover that with another plastic sheet held down with bricks. You want the soil to have a full day of sun exposure, and like with the other treatments, you want to make sure the water is properly moisturized before the day begins. Do this for 4 - 10 weeks straight (shorter time if the sun shines every day, longer time if the temperatures are cooler) to sterilize your garden soil.