Past positive experiences can increase herbivores’ motivation to eat low-quality foods. However, this is not always translated into a higher preference for low-quality foods in choice tests among foods of higher nutritional quality. Foraging behavior is also affected by properties of the feeding context because the quality and abundance of foods in nature change in time and space. We hypothesized that in a choice situation, the expression of a past positive experience with a low-quality food is modulated by the costs associated with selecting a high-quality food option. A total of 24 sheep were randomly assigned into two groups (n=12). During conditioning phase, one group (CS+; i.e., conditioned group) was fed with oat hay (a low-quality food) for 20 min and immediately after a ration of soybean meal (a nutritious food), whereas the other group was also fed with oat hay but the offer of soybean meal was delayed 5 h (CS−; i.e., control group). After conditioning, we assessed sheep motivation to eat the oat hay in an experimental arena in which accessibility to alfalfa hay (a high-quality food) was increasingly restricted. When alfalfa hay was readily accessible, CS+ and CS− sheep almost exclusively selected this food, showing a small and similar preference for oat hay. However, when accessibility to alfalfa hay decreased, intake and selection of oat hay was greater in the CS+ sheep than in the CS− sheep. The latter was a consequence of differential changes in behavior between groups; for example, sheep in CS+ spent more time foraging oat hay and were more likely to switch to oat hay if they had previously been eating alfalfa hay than sheep in CS−. Our results show that behavioral expression of the conditioned preference for a low-quality food depends on parameters of the feeding context (e.g., availability). We suggest that this can be the link between learning models and optimal foraging models of diet selection.