Dirt can be a valuable addition to your compost because it provides a source of beneficial microorganisms that help break down organic matter.
It can also add some weight and density to your compost, which can be helpful in maintaining proper moisture levels.
However, it's important to use clean soil that doesn't contain any contaminants like pesticides, herbicides, or heavy metals.
If you're unsure about the quality of the soil, it's best to avoid adding it to your compost.
Additionally, dirt itself doesn't compost, so it's best to add it in small amounts along with other organic materials like food scraps, yard waste, and paper products.
Aim for a balance of "greens" (nitrogen-rich materials like food scraps and grass clippings) and "browns" (carbon-rich materials like dried leaves and shredded paper), with a handful of dirt mixed in every so often.