According to the Encyclopedia Britannica, ammonia is a pure substance because it is a compound of the elements nitrogen and hydrogen. The two elements are joined chemically, so it cannot be considered a mixture.
In a mixture, the substances that are combined together keep their own chemical identities. For example, salt and sugar can be put together in a mixture, but the chemical properties of the substances will not change, and they could be separated back into salt and sugar.
Ammonia, which is a colorless gas made up of one nitrogen and three hydrogen atoms (NH3), is the simplest stable compound that can be made from these two elements.