When you interview someone or hand out applications, you may ask for the person's date of birth. In many cases, this is perfectly legal. You can gather information about employees or potential employees.
What you cannot do, however, is indicate that you prefer a specific age over another. This could be seen as age discrimination, which is illegal just like racial discrimination or gender discrimination.
For instance, you cannot put out an advertisement that asks college graduates between the ages of 22 and 28 to apply. You may want an entry-level worker who just got out of school but putting an age range on it discriminates against a wide variety of potential applicants.
Naturally, the job description may disqualify some of these individuals anyway. For instance, if you say that it is mandatory that the person has a four-year college degree, that is automatically going to eliminate most people under the age of 22. With rare exceptions, they simply will not be done with school yet.
However, you cannot simply pick the age itself as the cut-off point. What if someone took advanced classes and graduated at 20 years old? What if someone took eight years off to serve in the military and did not graduate until 30 years old? These workers also deserve a chance to apply.
Be very careful about the way you word your recruitment materials. You may accidentally discriminate against people without even realizing it.
If this happens, it can carry heavy ramifications for your company. Make sure you are well aware of all of the legal options that you have.