The purpose of the current study was to develop a photocatalytic method for the efficient removal of the azo dye RY17 from wastewater using g-C3N4 @CoO, a nanocomposite of cobalt oxide and glycine. The g-C3N4 @CoO nanocomposites were made using the heating method and the sintering process. XRD, SEM, and XPS structural studies of the g-C3N4 @CoO nanocomposite revealed that CoO nanoparticles had been successfully fixed to the gC3N4 structure. According to optical characterizations, the optical band gaps of g-C3N4, CoO nanoparticles, and gC3N4 @CoO nanocomposite were 2.88, 2.83, and 2.78 eV, respectively. Adding CoO nanoparticles to g-C3N4 nanosheets boosted their roughness and defect sites, according to electrochemical measurements, which resulted in the production of a sizable number of electro-active sites. The total dye elimination efficiencies of g-C3N4, CoO nanoparticles, and g-C3N4 @CoO nanocomposite were determined after 80, 70, and 55 min of solar light exposure. Additionally, g-C3N4 @CoO nanocomposite accelerated the photocatalytic decolorization of RY17 more quickly than g-C3N4, CoO nanoparticles did. After the photocatalytic performance of the substance was examined for RY17 decolorization from deionized water and textile effluent, it was found that g-C3N4 @CoO nanocomposite could be employed successfully for photocatalytically degrading RY17 from real textile wastewater.