Is it lawful for a fellowship linked to a permanent faculty position at a British university in the STEM field to only be available to females? The internally funded Anne McLaren Fellowships at The University of Nottingham state in their eligibility that "Candidates for the Anne McLaren Fellowships must be female and pursuing a career in a STEM subject". (link) One of the benefits of the fellowship is


  The linking of the Fellowship to an indefinite academic post, subject to performance against a high-quality threshold and the continued right to work in the UK


What this means is that fellows will be presented 2 contracts. The first is a 3-year fixed term research only contract with a start date mutually agreed upon by the university and fellow. The second contract is a permanent research and teaching contract with a start date immediately following the end of the first contract. The second contract has stipulations regarding if you get terminated during the first contract (e.g., due to a loss of the right to work in the UK or performance issues) then the second contract is also terminated. There is no hiring process at the time of the second contract.

The Equality Act 2010 protects people from being treated less favourably because of their gender during recruitment. Section 159 of the Act does allow positive action (e.g. favouring an underrepresented group in a tie-break) but as those not classed as female are completely excluded from applying then this appears to be unlawful discrimination not positive action.

It could be that The University of Nottingham has a general exception due to being a charity.  But then it would need to be included in the aim of the charity and the  University's Charter of Incorporation contains "16. The University shall treat students, staff and other people solely on the basis of their merits, abilities and potential, regardless of gender".
In the UK, there are a number of fellowships exclusively for women (e.g., L'Oréal WISE fellowship). The Equality Act of 2010 allows for positive action outside of recruitment which these fellowships likely fall under. The Equality Act of 2010, however, does not allow for positive action in recruitment (apart from giving preference for equally qualified applicants).

The Anne McLaren Fellowship is a little strange in that it is a fellowship that is linked to a permanent job. If you view it as a fellowship, it legal positive action. If you view it as a job, it is illegal positive action. I think the key thing is that when the school is making a decision about the job, the gender of the applicant is not considered. It is obviously very relevant to the school that the applicant has a fellowship as generous as the Anne McLaren fellowship, but the fact that the fellowship is limited to women does not matter in the hiring process. So the Equality Act of 2010 is likely not being violated.

Providing fellowships that only women are eligible for may go against the university charter or may be illegal in some other manner, but I do not think it runs afoul of the Equality Act of 2010.