How do natural changes in disease avoidance motivation shape thoughts about and behaviors toward ingroup and outgroup members? During the COVID-19 pandemic, political party affiliation has been a strong predictor in the United States of COVID-related opinions, attitudes, and behaviors. Using a six-wave longitudinal panel survey of representative Americans (on Prolific, N = 1,124, from Apr 2020 to Feb 2021), we explored how naturally-occurring changes across time in both risk of COVID-19 infection and people’s disease avoidance motivation shaped thoughts about and behaviors toward Republicans and Democrats (e.g., perceived infection threat, feelings of disgust, desires to avoid). We found a significant effect of dispositional level of motivation, over and above powerful effects of in-party favoritism/out-party derogation: participants with a dispositionally stronger motivation to avoid disease showed greater infection management responses especially toward Republicans; this held even for Republican participants. More important, we also found a significant interactive effect of within-person variability and ecological infection risk: participants who sensitively upregulated their motivation during the rapid spread of COVID-19 perceived greater infection threat by Republicans and felt less disgust toward and desire to avoid Democrats. This finding, too, held for Republican participants. These results provide evidence of functionally flexible within-person psychological disease avoidance—a theoretically important process long presumed and now demonstrated—and suggest another mechanism contributing to U.S. political polarization.