Herein, magnetic amine functionalized carbon nanotube (NH2-CNT/Fe2O3)-zeolitic imidazolate framework-8 (ZIF-8) nanocomposites (NH2-CNT/Fe2O3/ZIF-8: NCFZ) with different amounts of NH2-CNT/Fe2O3 (5, 10, and 15 wt% denoted as NCFZ-5, NCFZ-10, and NCFZ-15) were synthesized. The synthesized nanomaterials including ZIF-8, Fe2O3, CNT/Fe2O3, NH2-CNT/Fe2O3, CNT/Fe2O3/ZIF-8, NCFZ-5, NCFZ-10, and NCFZ-15 were characterized using BET, TEM, XRD, SEM, FTIR, VSM and zeta potential. The synthesized nanomaterials were applied for selective removing cationic dyes (MG: Malachite Green and RhB: Rhodamine B) from a binary system. Response surface methodology (RSM) and artificial neural networks (ANN) were used for optimizing dye removal. The BET data showed that the surface area of nanocomposite (NH2-CNT/Fe2O3/ZIF-8: 1659 m2/g) was higher than that of pure ZIF-8 (1485 m2/g). Contaminant removal obeyed the Freundlich isotherm and pseudo-second order kinetic models. The optimum adsorption condition predicted by RSM was pH = 6, dye concentration = 25 mg/L, Dosage = 0.004 g and at time = 145 min. The outputs of ANN model well overlapped with the experimental data. The binary system dye removal data indicated the synthesized nanocomposite with recycling and regeneration ability could be used for treating wastewater.