Be a good person and help others - Mentorship can have tactical benefits for the mentor, but I feel like a big motivation for most mentors is altruism. A lot of the best mentors out there just genuinely want to help other people and add value to their lives. This means that if you want to attract those great people, you should demonstrate that behavior yourself - Even the most junior engineer on the team can find opportunities to support others, even if it's as simple as answering a basic debugging question for a teammate.
Strive to ship quality work - Mentors, like everyone else, want good ROI on their time spent. And if someone is good enough to be an effective mentor in the tech industry, that means their time is extremely valuable. The nightmare scenario for a mentor is pouring a bunch of time into growing somebody and they aren't responding, continuing to pump out crappy work. By showing a hunger to do great work, this makes mentors feel more at ease taking you on as a mentee because they know that you will at least try really hard.
Demonstrate excellent communication skills - The mentor/mentee relationship, like any other, is an exercise in communication and trust-building. Like my prior point, if you demonstrate stellar communication skills, this is a positive signal to a potential mentor that they can grow you fast. Participate in team meetings, ask good questions, respond to code review feedback (and all feedback) well - These are all things you should be doing anyways, and they're effectively required if you want to attract a good mentor.
I talk about all this in-depth across these resources as well: