Artificial photosynthesis of hydrogen peroxide (H2O2) is a hopeful alternative to the industrial anthraquinone process. However, rational fabrication of the photocatalysts for the production of H2O2 without any sacrificial agents is still a formidable challenge. Herein, two kinds of linear conjugated polymers (LCPs) including pyridinic N functionalized polymer (DEB-N2) and pyridinic N non-contained polymer (DEB-N0) were successfully synthesized. DEB-N2 displays enhanced light capturing ability and good dispersion in water, leading to a substantial initial H2O2 generation rate of 3492μmol g-1h−1 as well as remarkable photocatalytic stability in pure water. Furthermore, the temperature programmed desorption (TPD) and density functional theory (DFT) analysis reveal that highly electronegative pyridine-N atoms in DEB-N2 boost the adsorption affinity of oxygen molecules, which facilitates the occurrence of the oxygen reduction reaction, therefore enhancing the performance of photocatalytic H2O2 production. This study unveils that the presence of pyridinic N in DEB-N2 has a significant impact on photocatalytic H2O2 production, suggesting the precise manipulation of the chemical structure of polymer photocatalysts is essential to achieve efficient solar-to-chemical energy conversion.