The molecular genetic mechanisms facilitating local adaptation in salmonids continue to be poorly characterized. Gene transcription is a highly regulated step in the expression of a phenotype and it has been shown to respond to selection and thus may be one mechanism that facilitates the development of local adaptation. Advances in molecular genetic tools and an increased understanding of the functional roles of specific genes allow us to test hypotheses concerning the role of variable environments in shaping transcription at known-function candidate loci. To address these hypotheses, wild rainbow trout were collected in their first summer and subjected to metabolic and immune challenges. We assayed gene transcription at candidate loci that play a role in the molecular genetic response to these stresses, and correlated transcription with temperature data from the streams and the abundance and diversity of bacteria as characterized by massively parallel pyrosequencing. Patterns of transcriptional regulation from resting to induced levels varied among populations for both treatments. Co-inertia analysis demonstrated significant associations between resting levels of metabolic gene transcription and thermal regime (R2 = 0.19, P = 0.013) as well as in response to challenge (R2 = 0.39, P = 0.001) and resting state and challenged levels of cytokine gene transcription with relative abundances of bacteria (resting: R2 = 0.25, P = 0.009, challenged: R2 = 0.65, P = 0.001). These results show that variable environments, even within a small geographic range (<250 km), can drive divergent selection among populations for transcription of genes related to surviving stress.