Conjugated microporous polymers (CMPs) have emerged as advanced membranes with unique pore structures for the separation of small kinetic diameter gases, including H2. In this work, we present a comprehensive investigation into the potential of N-doped pyridinyl functionalized conjugated microporous polymers, denoted as CHNX (X = 1, 2, 6), in H2 purification by using molecular dynamic simulations. Our findings demonstrate that CHNX membranes exhibit exceptional H2 purification performance with both high H2 selectivity and permeance. Notably, the CHN6 membrane shows the highest H2 permeance of 2.61 × 10−5 mol m−2 s−1 Pa−1, owing to its larger pore area relative to the other membranes. Moreover, both CHN and CHN2 membranes achieve 100 % gas selectivity based on the molar sieving mechanism. To gain deeper insights into the gas separation process, we analyze the gas-membrane interaction, 2D density distribution, center of mass, mean square displacement, etc. The elucidation of these dynamics enhances our understanding of the underlying gas separation mechanisms. Ultimately, this work provides crucial theoretical guidance for the future development of gas separation membranes in hydrogen purification applications, thereby advancing the field of sustainable energy production.