The solver’s result message, showing the optimal value and the numbers of iterations and nodes, can be suppressed by executing this AMPL statement before solving:
option solver_msg 0;
However, in some cases, other output may “leak” out of the solver. To remove that output, also redirect the “solve” output to the system null file, like this:
solve >NUL; # if using Windows
solve >/dev/null; # if using Linux or macOS