Recently, removing dyes from wastewater by photocatalysis has been extensively studied by several researchers. However, there exists a research gap in optimizing the photocatalytic process parameters using artificial intelligence to maintain the associated techno-economic feasibility. Hence, this investigation attempts to optimize the photocatalytic degradation of methylene blue (MB) dye using an artificial neural network (ANN) model to minimize the capital and running costs, which is beneficial for industrial applications. A ZnO/MgO photocatalyst was synthesized, showing an energy band gap of 2.96 eV, crystallinity index of 71.92%, pore volume of 0.529 cm3/g, surface area of 30.536 m2/g, and multiple surface functional groups. An ANN model, with a 4-8-1 topology, trainlm training function, and feed-forward back-propagation algorithm, succeeded in predicting the MB removal efficiency (R2 = 0.946 and mean squared error = 11.2). The ANN-based optimized condition depicted that over 99% of MB could be removed under C0 = 16.42 mg/L, pH = 9.95, and catalyst dosage = 905 mg/L within 174 min. This optimum condition corresponded to a treatment cost of USD 8.52/m3 cheaper than the price estimated from the unoptimized photocatalytic system by ≈7%. The study outputs revealed positive correlations with the sustainable development goals accompanied by pollution reduction, human health protection, and aquatic species conservation.