We studied the food and habitat preferences of beetles of the subfamily Scarabaeinae in a protected tropical monsoon forest, the Wasgomuwa National Park in Sri Lanka. While gaining an insight into the capacity of different resources to support dung beetles, we tested the hypothesis that, in a landscape with a mosaic of habitat types and a diversity of large mammals, specialization facilitates coexistence of the scarabs. Pitfall traps were laid in five distinct habitat types (forest, riverine, sandy banks, scrub and grassland), and baited with five dung types (leopard, cervid, elephant, bear and buffalo). Four hundred and fifty seven beetles of 22 species in seven genera were recorded. Significant differences were seen in the species richness and abundance of dung beetles between different habitats and dung types, indicating habitat and food preferences. The highest richness of scarabs was in the riverine habitat and in leopard dung. Niche breath values of the individual species indicated differences in the degrees of specialization, while niche overlap values indicated a greater sharing of dung beetle species between similar habitats and dung types than between dissimilar ones. These findings provide evidence that selectivity of habitat, and dung, may be important in promoting coexistence among the scarabs in a tropical environment.