If this guy is your friend then I really don't think that he will think you are just after attention if you talk to him about this. I mean if he cares about you so much that you are already convinced that he wants to know then I don't think that's something you have to worry about. There's no statute of limitations on when you can share the details of a traumatic experience with someone. I would start off simply saying "You know that I've been raped, don't you? Well what I've not told you, but what I really want to tell you, is that I have been having this recurring dream ever since, and I really need to talk about it - not just the dream, but the whole thing with someone, and I trust you and I'd like to talk to you about it, if that's okay."
I actually wouldn't simply start off with the dream because that might begin to sound like an innocuous subject and you really need him to know form the start that this is important to you. He might want to set aside some time when you can properly talk about it rather than simply go into it there and then so if you say what I suggested above then you give him an opportunity to suggest how and when would be the best place to talk about it.
I think once you do that you can say to him "I know it's been a while and I don't want it to look like I'm just after attention. It's just that I guess it takes time for these things to come out, and this dream is really scaring me and I think talking about it now that some time has passed might help me to get over it, especially talking about it with you."
Don't forget that it's perfectly natural for it to take time for your feelings to get to a point where you can actually reflect on them, vocalise them, and share them with someone. What you'r experiencing is a perfectly normal part of the healing process and I think it's actually really positive that you have someone there with you who you can talk to and work this through with. It takes time for you to really absorb what has happened and for you to be able to bring it out into the open again in your own terms, but I think your mind is telling you that now you are ready for that step. Talking abotu the details with him, sharing the experience explicitly with someone may seem like a difficult and perhaps unpleasant thing for them as well as for yourself, but any friend will understand that this is something you need to do to help you come to terms with your experience.
I think you are very brave for considering talking about it and I think that this will be an important part of your healing from the event. Please make sure you do go through with it. Your friend will be honoured that you trust him enough to do this and to share this with him, and it will only deepen your friendship. It's what friends are there for, so please lean on him and let yourself do this.
Good luck
~Mark