When the amino acid comes to the ribosome it is in the form of an aminoacyl tRNA in which the carboxyl group of the amino acid is esterified with the 3' OH group of the ribose moiety at the 3' end of the tRNA.
There is already a growing peptide bound in the P site of the ribosome with a free -COOH group which will react with the -NH2 group of the incoming amino acid in the A site to form the next peptide bond. This reaction takes place in the context of what is essentially an enzymic active site. The reactants will be held in the correct positions for catalysis to take place (in this case the catalysis is carried out by the ribozyme activity of the small ribosomal RNA).
So the answer is that the selectivity of this reaction is just another example of the way in which enzymes are able to carry out highly-specific reactions. So, for example, the enzyme hexokinase, which phosphorylates glucose at the 6 position has, potentially, four other -OH groups that, chemically speaking, could be phosphorylated.