Things You'll Need
Carbon-rich organic waste
Cylindrical plastic garbage can
Drill with 5/8-inch bit
Window screening material
Drawn by the scent of decomposing nitrogen-rich waste, flies often become a fact of life for both veteran composters and newcomers to the world of composting. According to Deborah Martin, co-author of "The Rodale Book of Composting," fly species attracted to compost include soldier flies, horseflies, minute flies, houseflies and black fungus gnats. Adults feed on the organic matter and lay eggs in your decomposing compost. Larvae, in the form of maggots, wiggle around vigorously in your compost, consuming decomposing waste as they grow. Getting rid of flies in compost requires that you practice preventative tactics and maintain your compost regularly.
Avoid providing the flies with prime locations for laying their eggs. Create a crater in your compost heap with a trowel and drop any nitrogen-rich food waste or animal manure into the hole. Sprinkle a 3- to 4-inch layer of carbon-rich organic waste (such as straw, sawdust or shredded newspaper) on top of the high-nitrogen waste to decrease odors and prevent the flies from being able to lay eggs on it.
Cover your compost pile with a plastic sheet or tarpaulin to prevent the flies from entering your compost. Choose a sturdy plastic sheet that is large enough to cover the entire compost pile completely. Spread the plastic sheet over the compost heap, allowing the edges to lie on the ground next to the compost. Place closely spaced cinder blocks or bricks on the edges of the plastic cover to discourage flies from getting into the compost.
Turn your compost once or twice weekly to increase bacterial activity, which heats up the compost to high temperatures capable of killing fly larvae. Use a manure fork to scoop compost from the outside edges of your pile or bin to the center. Shift compost from the center of the pile to the edges. Insert a compost thermometer straight down into the center of your compost pile or bin. Once it reaches 140 degrees F, check the thermometer every two to three days to ensure that it remains at that temperature for at least two weeks.
Transfer your compost to a closed composting container. Drill evenly spaced, 5/8-inch holes in the sides and bottom of a cylindrical plastic trash can to provide ventilation. Cut small pieces of window screening and use it to line the ventilation holes to keep the flies from entering your compost bin. Tape the window screen pieces into place with strips of duct tape. Turn your compost barrel on its side and rotate it across the soil several rotations once every week to aerate the compost.
Make sure your compost is not too wet, which can cause anaerobic decomposition and attract more flies. Ideally, you should be able to squeeze out only one to two drops of moisture from a handful of compost, according to the University of Illinois Cooperative Extension.