Background: Expanding opportunities to experience engaging STEM educational programs is an important pathway to increasing students' interest and competencies in STEM and, ultimately, motivation to pursue STEM careers. After-school programs offer one means to achieve this aim, but barriers such as a lack of transportation or available teachers may limit participation for some students in this context. Transitioning after-school STEM programs to in-school can provide opportunities to increase reach by removing these and other barriers. However, it is likely that this change in the learning context, from after-school to in-school, impacts student experiences and, ultimately, program efficacy by altering how students and teachers interact; as teachers and students adjust their behaviors and expectations to a more traditional learning context. To examine this potential effect, self-determination theory was used to frame how the learning context influences the social and motivational outcomes of a STEM program for underserved youth. In-school (N = 244; 39% girls, M age = 13, 63% Caucasian, 18% African American, 6% Multiracial) and after-school (N = 70, 33% girls, M age = 12, 55% Caucasian, 16% Multiracial, 13% Latino/a) program students completed surveys that assessed teacher-student interactions, and student psychological needs and motivation. In a structural equation model, student perceptions of teachers were entered as predictors of motivation for the program directly and mediated by psychological need satisfaction. Learning context (0 = in-school, 1 = after-school) was entered as a ubiquitous predictor. Results: Findings support the theorized model where perceptions of teachers positively predicted psychological need satisfaction (R 2 = .20), and both variables positively predicted more self-determined motivation (R 2 = .30-.35). Findings also demonstrate an effect of learning context where learning context negatively predicted the less self-determined motivations only (R 2 = .06-.10) (i.e., in-school contexts are associated with less desirable motivational outcomes). Conclusion: Findings reinforce the instrumental role of students' positive perceptions of teachers in fostering a more desirable self-determined motivation for STEM program participation. Additionally, in-school programs must consider and integrate novel approaches that mitigate the negative impact of established in-school structures and processes (e.g., grades and mandatory participation) on student motivation for these programs and, potentially, interest in STEM careers.