Fishes use their mechanoreceptive lateral line system to sense nearby objects by detecting slight fluctuations in hydrodynamic motion within their immediate environment. Species of fish from different habitats often display specialisations of the lateral line system, in particular the distribution and abundance of neuromasts, but the lateral line can also exhibit considerable diversity within a species. Here, we provide the first investigation of the lateral line system of the Australian western rainbowfish (Melanotaenia australis), a species that occupies a diversity of freshwater habitats across semi-arid northwest Australia. We collected 155 individuals from eight populations and surveyed each habitat for environmental factors that may contribute to lateral line specialisation, including water flow, predation risk, habitat structure and prey availability. Scanning electron microscopy and fluorescent dye labelling were used to describe the lateral line system in M. australis, and to examine whether the abundance and arrangement of superficial neuromasts (SNs) varied within and among populations. We found that the SNs of M. australis were present in distinct body regions rather than lines. The abundance of SNs within each body region was highly variable, and also differed among populations and individuals. Variation in SN abundance among populations was best explained by habitat structure and the availability of invertebrate prey. Our finding that specific environmental factors explain among-population variation in a key sensory system suggests that the ability to acquire sensory information is specialised for the particular behavioural needs of the animal.