How to focus on oneself and not on looking for a partner?

Like it feels like no matter how hard I try to focus on working and my life. I’m still attracted to a girl at work or somewhere else. Like I’m not desperate or feel like I need a girlfriend to be happy or ok in life. I want my focus right now to be on making money, getting in shape and family.
How to focus on oneself and not on looking for a partner?
Post Opinion