Many employers have chosen to stop asking for ages or dates of birth on application forms. However, although they must comply with data protection law in handling job applications, it is not automatically unlawful for employers to ask for this information.
Including a separate sheet with a job application pack to gather personal information for monitoring purposes is usually regarded as good employment practice. But if you think you have been refused a job because of your age, the fact that the employer has asked for a date of birth on the main application form could form part of the evidence of your case against them. This is likely to be especially relevant where there is a pattern of people from other age groups being treated more favourably in recruitment or in other ways by the same employer.