Large numbers of ants are usually an indication that the heap is too dry. To encourage them to leave the pile, moisten and turn it or stir it with a pitchfork to disrupt their colonies. After stirring the heap leave it alone for a time to give the ants a chance to leave.
If there are many ants in your yard, they may return to the compost pile. However, ants may actually benefit the composting process by bringing fungi and other organisms into their nests. The work of ants can make compost richer in phosphorus and potassium by moving minerals from one place to another.
Posted in: Composting FAQ