Background: Autism spectrum disorder (ASD), a condition defined by deficits in social communication, restricted interests, and repetitive behaviors, is associated with early impairments in motor imitation that persist through childhood and into adulthood. Alterations in the mirror neuron system (MNS), crucial for interpreting and imitating actions, may underlie these ASD-associated differences in motor imitation. High-density diffuse optical tomography (HD-DOT) overcomes logistical challenges of functional magnetic resonance imaging to enable identification of neural substrates of naturalistic motor imitation. Objective: We aim to investigate brain function underlying motor observation and imitation in autistic and non-autistic adults. We hypothesize that HD-DOT will reveal greater activation in regions associated with the MNS during motor imitation than motor observation, and that MNS activity will negatively correlate with autistic traits and motor fidelity. Methods: We imaged brain function using HD-DOT in N = 100 participants as they engaged in observing or imitating a sequence of arm movements. Additionally, during imitation, participant movements were simultaneously recorded with 3D cameras for computer-vision-based assessment of motor imitation (CAMI). Cortical responses were estimated using general linear models, and multiple regression was used to test for associations with autistic traits, assessed via the Social Responsiveness Scale-2 (SRS), and imitation fidelity, assessed via CAMI. Results: Both observing and imitating motor movements elicited significant activations in higher-order visual and MNS regions, including the inferior parietal lobule, superior temporal gyrus, and inferior frontal gyrus. Imitation additionally exhibited greater activation in the superior parietal lobule, primary motor cortex, and supplementary motor area. Notably, the right temporal-parietal junction exhibited activation during observation but not during imitation. Higher autistic traits were associated with increased activation during motor observation in the right superior parietal lobule. No significant correlation between brain activation and CAMI scores was observed. Conclusions: Our findings provide robust evidence of shared and task-specific cortical responses underlying motor observation and imitation, emphasizing the differential engagement of MNS regions during motor observation and imitation.