Background: Prioritization strategy during gait significantly influences gait performance and successful gait relies on interactions between cognitive and motor functions. This study aimed to examine the within- and between-network connectivities of cognitive and motor networks associated with dual-task priority during gait. Methods: Twenty-nine healthy individuals (66.86 ± 8.53 years) underwent the timed-up-and-go (TUG) test alone, TUG with a cognitive task, and the cognitive task alone. The cognitive task involved sequentially subtracting three from a random number between 50 and 100. The resting-state functional magnetic resonance imaging was acquired on the same day. Using independent component analysis, the dorsal attention network (DAN), frontoparietal network (FPN), primary motor network (PM), and lateral motor network were assessed. The participants were divided into cognitive and motor priority groups based on the modified attention allocation index (mAAI). Group comparisons of within- and between-network connectivity were conducted using permutation tests. Additionally, correlation analysis was employed to investigate the association between-network connectivity and task priority. Results: The cognitive priority group showed cognitive dual-task facilitation. In comparison to the motor priority group, they also showed comparable motor dual-task costs and lower combined dual-task costs. They exhibited increased within-network connectivity in the left FPN and enhanced between-network connectivity between the right FPN and both the DAN and PM. These between-network connectivities were negatively correlated with mAAI scores. Conclusion: The results suggest distinct neural mechanisms across cognitive and motor networks based on individuals' dual-task strategies. This may have implications for understanding gait performance in complex contexts.