Yes! I think this is one of the best ways, not just for diversity, but for growing the community in general.
If you’re in the position to hire a lecturer for a programming course, then you can. Just hire somebody who’s already a role model!
I was really excited to see that Grant Sanderson, one of my favorite youtubers, is giving an on-line lecture series in Julia as part of an MIT course. This is probably the best thing that has happened to the language since dot broadcasting. I’m sure many of his millions of subscribers see him as a role model, and will want to try out Julia just because they saw him use it. (An many of those people will be from a minority of some kind.)
But wouldn’t it be really cool if, next year, MIT would also hire a popular female (or otherwise underrepresented in tech) youtuber to give a few lectures in that course? Maybe Dianna Cowern or Mayuko Inoue.
I think that seeing somebody do something affects our perception of who can do that thing much more than reading about it. That’s just the way our brains are wired.