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?
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.