Visual search is supported by an internal representation of the target, the attentional template. However, which features are diagnostic of target presence critically depends on the distractors as well. Accordingly, previous research showed that consistent distractor context shapes the attentional template for simple targets, with the template emphasizing diagnostic dimensions (e.g., colour or orientation) in blocks of trials. Here, we investigated how distractor expectations bias attentional templates for complex shapes, and tested whether such biases reflect inter-trial priming or can be instantiated flexibly. Participants searched for novel shapes (cued by name) in two probabilistic distractor contexts: either the target’s orientation or rectilinearity was unique (80% validity). Across four experiments, performance was better when the distractor context was expected, indicating that target features in the expected diagnostic dimension were emphasized. Attentional templates were biased by distractor expectations when distractor context was blocked, independently of self-reported awareness of the manipulation. Interestingly, attentional templates were also biased when distractor context was cued on a trial-by-trial basis, but only when the two contexts were consistently presented at distinct spatial locations. These results show that attentional templates can be highly flexible, incorporating expectations about target-distractor relations when looking for the same object in different contexts.Public significance statementWhen searching for an object (e.g., a green ball), the visual features that distinguish it from distractor objects depend on the features of these distractors (e.g., when searching among plants, its green colour is not useful to find the target). Here, we asked participants to search for novel shapes in contexts where different dimensions of the shapes were unique. We show that people readily learn which features are diagnostic in these distractor contexts and flexibly use expectations about the features that are diagnostic of the target to efficiently guide search.Adaptive Biasing of Attentional Templates Based on Expected Distractor Context