There's been a lot of research demonstrating that it's not actually a lack of interest among girls, it's the barriers they face as they move forward within STEM careers. A lot of the representations that I mentioned are big barriers.
It's been indicated that having more accurate role models who are from a diverse group maintains girls' interest in STEM and helps them foster a sense of belonging. Hands-on activities, co-operative learning environments, and project-based learning maintain their interest. A lot of outreach programs do these as well.