Only in very narrow circumstances.
If an employer can show that there is a particular need for someone of a certain age to do a job, this will count as a genuine occupational requirement (GOR) and will not be regarded as unlawful. However, in practice, few recruitment decisions are likely to benefit from this exemption, because of the danger that the employer is making stereotypical assumptions about you because of your age, instead of thinking about your individual aptitudes and skills.
Employers should not make generalised and stereotypical judgments about fitness based on age, where a less discriminatory option is available. Even so, an age limit for a job can sometimes be justified in a safety critical context. In a 2017 ruling involving airline carrier Lufthansa, the European Court of Justice accepted that some physical capabilities do inevitably decline with age. In that case, a blanket retirement age of 65 for commercial airline pilots instead of a system of individual testing was found to be justified.
Any GOR should be spelled out clearly in the job profile and/or person specification when you apply for the job.
An employer can refuse to offer you the job if you cannot comply with a statutory requirement. For example, it is not unlawful to refuse to employ a young worker who is not yet old enough to qualify for the driving licence for the vehicle they need to drive.