Public trust in science is polarized along political lines. Conservatives trust scientists and their findings less than do liberals – but why? Here, we show that people across the political spectrum hold stereotypes about scientists' political orientation (e.g., "scientists are liberal"), compare that to their own political orientation, and only trust scientists to the degree that they perceive them to be ideologically similar. Thus, we predict that the link between political orientation and trust in scientists is affected by political stereotypes about scientists. We tested this hypothesis in five studies in Germany and the US and combined a series of highly controlled experimental and correlational studies (total N = 2,859) with a large-scale analysis of Twitter data (N = 3,977,868). We experimentally manipulated scientists' perceived political orientation (study 1) or used naturally occurring variations in political stereotypes about scientific disciplines (e.g., "sociologists are liberal", studies 2 to 5). Across all studies, we consistently observed that stereotypes about scientists explain the link between political orientation and trust in scientists. Results showed that conservatives’ distrust in scientists is substantially reduced for stereotypically moderate disciplines (e.g., economists) and even reversed for scientists perceived as conservative. Confirming the critical consequences of this finding, the effect shaped participants' perceptions of the value of science, their protective behavior intentions during a pandemic, policy support, and information-seeking behavior.