If the ants cause no harm, they are not to be killed. The Prophet salla Allahu alaihi wa salaam prohibited killing ants, bees, hoopoes, and sparrow-hawks (Abu Dawud).  This case only applies when they cause no harm.

Read more