Girls do not take physics at A-level because they think the subject is only for white boys, MPs have been told.
No mention of female scientists in the national curriculum contributes to "the message society gives" to discourage girls from picking physics, leading physicist Prof Dame Athene Donald said.
"If you are black or if you are a woman, you don't see yourself fitting in," she said.
In 2021, 23% of physics A-level entrants were female.
This is a slight increase on previous years.
Prof Donald, from the University of Cambridge, told the Commons Science and Technology Committee it was "relevant" that "most of the images one sees of scientists, physicists, are white males".
Teachers should try to "actively counter" messages from wider society that may discourage girls and children belonging to ethnic minorities from certain subjects, she added.
"In my generation I know lots of women who said 'I would have loved to do sciences at A-level, but my school discouraged me'. I don't for one moment expect that still to be true, but there's a difference between active discouragement and no active encouragement."
The panel session comes after a government adviser was criticised for saying girls avoid physics because of its "hard maths".
Social mobility adviser and head teacher Katharine Birbalsingh said physics was not a subject girls "tend to fancy", adding: "I just think they don't like it."
The IOP said it was alarmed by the comments, and Ms Birbalsingh later said her language had been "clunky".
Prof Donald said Ofsted could help encourage girls to choose A-level physics by tracking the gender balance of subjects as part of its school inspections.
"If Ofsted made gender equity an issue then every school would have to think, in primary school as well, 'what are we doing, without thinking about it are we giving boys different games to play, or different tasks?'."
In response, Ofsted's Dr Jasper Green told the committee that school inspectors were already addressing how to improve girls' participation in science and maths, "but we are focusing on the quality of education, on early education, on subjects, and all of those moves are the right ones to encourage wider participation at A-level".
He said gender balance could become something for Ofsted to consider assessing in the future, but that there were "challenges" in both measuring and improving it.