In this study, Chemical activation was used to prepare a low-cost activated carbon (AC) from agricultural waste material: Cucumis melo. It was used as a green biosorbent for the removal of cationic and anionic dyes from aqueous solutions (Methylene blue (MB) and Acid orange 7 (AO7)).A full factorial 24 experimental design was used to optimize the preparation conditions. The factors and levels included are activation temperature (300 and 500ºC), activation time (1 and 3 h), H3PO4 concentration (1.5 and 2.5 mol/L), and contact time (60 and 90 min). The surface area of the activated carbons and high removal efficiency of MB and AO7 was chosen as a measure of the optimization. The activated carbon prepared at 500 °C, for 3 hours with an H3PO4 concentration of 2.5 mol/L and a contact time of 90 min, have the largest specific surface area (475 m2/g) and the percentage of discoloration of methylene blue (99.4%). Furthermore, the greater value of AO7 removal (94.20%) was obtained at 3h - activation time, 500°C - activation temperature, 1.5 mol/L - H3PO4 concentration with a 90 min contact time.