H2 could be the most promising, sustainable, and alternative energy source in the foreseeable future. In this study, a gel-like Ag-containing dicyandiamide metal–organic supramolecular network (MOSN) has been prepared as a precursor to synthesize g-C3N4 for photocatalytic H2 evolution under light irradiation. Ag can be well incorporated into the g-C3N4 structure by using Ag-containing dicyandiamide MOSN as a precursor to produce a metal–semiconductor interface, thereby promoting the charge separation (evidenced by electrochemical impedance spectroscopy and photocurrent density measurement) and ultraviolet–visible light absorption (UV–vis absorption spectroscopy) and photocatalytic activity for H2 evolution. g-C3N4 derived from the Ag-containing dicyandiamide MOSN exhibits high H2 evolution after Pt loadings under light irradiation (λ > 400, 450, and 550 nm) in the presence of triethanolamine. In summary, g-C3N4 synthesized from Ag-containing dicyandiamide supramolecules can be used as an effective photocatalyst for H2 production.