Atlantic Forest (AF) is a threatened megadiverse biome distributed from north to south along the ocean of South America and is considered a hotspot of biodiversity. Currently, over 3000 ant taxa are known to occur in AF ecosystems, and many more are expected but may never be acknowledged. The patterns and processes structuring AF ant communities are not well known, urging such studies. Temperature is a fundamental environmental condition that modulates ant species occurrences at different local and regional scales. Global warming may deeply impact species occurrence, dynamics and interactions, and efforts to amplify our understanding of AF biodiversity are urgent. Ants are widely distributed in the dunes, and many species are sensitive to local changes in temperature as some species are considered thermophilic. In open areas such as dunes, the temperature varies considerably over 24 h, with great changes mainly between day and night. In this study, we sought to answer whether the foredune ant community of the Restinga, one of the habitats of the AF, is structured by temperature from day and night. For this, we tested the following hypotheses: (i) temperature influences ant diversity; (ii) in warmer periods, there is a decrease in richness, with an increase in abundance; and (iii) ant species composition varies throughout the day and, consequently, at different temperatures. We arbitrarily drew a parallel transect to the ocean composed of 15 pitfall trap units spaced every 30 m. Traps were changed in five sampling periods: T1 (9:10–13:10 h), T2 (13:40–18:40 h), T3 (19:00–23:00 h), T4 (23:00–03:00 h) and T5 (03:00–07:00 h). In each period, we recorded the ambient temperature and relative humidity. We recovered 11 ant species on the foredunes. Our results showed that the richness and abundance of ants in the daytime period was higher than in the night‐time period, suggesting that temperature positively affected these two parameters of the studied community. The species composition also changed over the sampling periods. Considering that our aim was to describe the species diversity across 24 h of sampling, this ‘quick‐shot’ of the ant community allowed us to determine that temperature and humidity shape their occurrence and activity. These results indicate that there is an interplay between these factors that are correlated and play an important role in structuring ant communities in Restinga foredunes.