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.
When employers ask for personal information in the context of a job application it is usually because they want to monitor the diversity of their candidate pool. Personal information gathered for recruitment monitoring should be anonymised and kept separate from the rest of the application form, so that it is not seen by those in charge of deciding who should get the job. This is good practice and it also limits the risk of both age discrimination and also any breach of data protection law.
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.