Ants occupy huge biomass in the terrestrial ecosystem. Several ant species are highly aggressive and equipped with venomous stingers and/or formic acid. Therefore, ants are abundant but potentially unpalatable prey for some predators. So far, however, the role of ants as prey is not well understood. In this study, we focused anurans (frogs and toads) as one of the major predators of terrestrial arthropods. Using two anuran species and three ant species sharing the habitats, we asked two questions. First, we hypothesized that the anuran preference for prey is ant‐species specific, and tested whether anuran prey preference is affected by ant aggressiveness. Second, we hypothesized that the anurans may innately avoid aggressive ants. To test this hypothesis, ant‐naïve anuran juveniles (Bufo toad and Rana frog) were reared from tadpoles, and juveniles' preferences for three ant species with variable aggressiveness were tested. The exposure to different ant species showed that anuran juveniles highly avoided aggressive ants (Lasius and Brachyponera) compared to less aggressive ants (Tetramorium). Additionally, ant‐naive juvenile toads avoided the aggressive ants without prior experience. In contrast, ant‐naïve juvenile frogs attacked the most of firstly encountered ants and then learned to avoid the unpalatable ants. These findings suggest that (1) some anurans selectively avoid aggressive ant species, (2) Bufo toads have innate avoidance to some ants, while Rana frogs learn to avoid the unpalatable prey.