Food acquisition is an important modulator of animal behavior and habitat selection that can affect fitness. Optimal foraging theory predicts that predators should select habitat patches to maximize their foraging success and net energy gain, likely achieved by targeting areas with high prey availability. However, it is debated whether prey availability drives fine‐scale habitat selection for predators. We assessed whether an ambush predator, the timber rattlesnake (Crotalus horridus), exhibits optimal foraging site selection based on the spatial distribution and availability of prey. We used passive infrared camera trap detections of potential small mammal prey (Peromyscus spp., Tamias striatus, and Sciurus spp.) to generate variables of prey availability across the study area and used whether a snake was observed in a foraging location or not to model optimal foraging in timber rattlesnakes. Our models of small mammal spatial distributions broadly predicted that prey availability was greatest in mature deciduous forests, but T. striatus and Sciurus spp. exhibited greater spatial heterogeneity compared with Peromyscus spp. We found the spatial distribution of cumulative small mammal encounters (i.e., overall prey availability), rather than the distribution of any one species, to be highly predictive of snake foraging. Timber rattlesnakes appear to forage where the probability of encountering prey is greatest. Our study provides evidence for fine‐scale optimal foraging in a low‐energy, ambush predator and offers new insights into drivers of snake foraging and habitat selection.