Hi.
You certainly can't help who you get a crush on, but this sounds like an attraction that is better left unexplored--any more than it has been. The combination of his being married and of a higher rank would probably put you in an uncomfortable position if you were to get involved. But you seem to know all of that...
It sounds like your question is how to get over the attraction. That may just take time, but there also might be some things you can do to help speed up the process--questions you can ask yourself or different ways of thinking about this guy.
Perhaps, for example, his unavailability is actually part of your attraction. Picture him your age and free as a bird. Would you still be so into him? What about distractions? Is there some project or hobby that might distract you from thinking about him so much?
It might also help to focus on the upside of your situation. Maybe take a cue from your interest in this guy about what you might seek in an "available" boyfriend. Have you learned anything from this experience about the qualities that matter to you in a man?