Dispersal is a crucial process for animal populations as it allows the colonisation of new habitats and the maintenance of genetic diversity. However, it has not been studied enough for soil fauna, which is the basis for a wide variety of ecosystem services. Therefore, the study of their dispersal and the factors that trigger this behaviour is a relevant area of knowledge for the maintenance of the services they provide. For this work, Carpetania matritensis, an endogeic earthworm species endemic to the central Iberian Peninsula, has been used as a model to study the effect of habitat quality and conspecific density on dispersal and exploratory behaviour. The experiment was carried out in horizontal mesocosms divided into three sectors of the same dimensions: an inoculation section (left), a crossing section (centre) and a target sector (right). Those sectors were occupied by soil, a favourable habitat for earthworms, or sand, which represents an unsuitable habitat for earthworms and a physical barrier for their displacement. Earthworms were inoculated at two different densities (2 and 6 individuals per mesocosm; 848.86 and 2546.58 individuals/m3 respectively) and at two experimental durations (4 and 8 days) for each of the three different experimental treatments (unsuitable-unsuitable-suitable (U-U-S), suitable-unsuitable-suitable (S-U-S) and suitable-suitable-suitable (S-S-S), depending on the habitat type filling the inoculation, crossing and target section respectively). The results showed a large effect of treatment on the dispersal rate, being higher when earthworms were inoculated in an adverse environment, establishing habitat quality as a driver of the species’ dispersal behaviour. No significant effects of conspecific density, experimental duration or its interactions were found. Further studies are needed to clarify the species dispersal behaviour with a view to its conservation.