It is not unlawful for an employer to collect information on race, ethnicity and other protected characteristics when recruiting new staff. Many organisations choose to do so in order to monitor the effectiveness of their equal opportunities policy. However, you do not have to give this information if you do not want to. Employers are under a duty not to treat you differently because of your age, disability, sex, gender reassignment, sexual orientation, race, religion or belief, or marriage.
See the UK Government's Equality Act 2010 webpages for further information on your rights, what areas are covered by the act and what action you can take if you feel you have been unfairly discriminated against.