Did you get this information from having an ultrasound? If so, it should be clear that the sex in late June didn't get you pregnant, as was also shown if you had periods that came later than the last sex in June.
But because your explanation is a more than 40-word sentence with no punctuation, it's hard to be sure I understand what you are saying. The sentence is,
"I had sex with my ex 06/22/22 but I came on my cycle at the end of June then I came on my cycle again July 21st I had sex with another dude who I’m currently with now July 31st who would the father be?
Did you mean:
I had sex with my ex 06/22/22
but I came on my cycle at the end of June.
Then I came on my cycle again July 21st.
I had sex with another dude (who I’m currently with
now) July 31st.
Who would the father be?
Or did you mean
I had sex with my ex 06/22/22
but I came on my cycle.
At the end of June then I came on my cycle again.
July 21st I had sex with another dude who I’m
currently with now July 31st.
Who would the father be?
If the first version is what you meant, you're saying your period came after the last time you had sex with your ex? In fact, you are saying two periods came after sex with your ex. So you can rule out your ex. If you had an ultrasound, and it said you were only at almost 5 weeks when it was August 25, that also rules out conception in June. Unless there is a third guy you haven't mentioned, or you had sex with your ex later, the only choice is the guy you are with now. (I assume you're saying you had sex with him from July 31 on.)
It sounds like when you went to the clinic on August 25, they did a count from July 21, because that was the day you gave them as the first day of your last period. In the medical world, pregnancies are counted starting from that point. They don't know when you ovulated, so they use the first day of your period as "day 1" of the whole 9-month pregnancy time frame. At "day 1" your period starts, around "day 14," you ovulate, and around day 28 you'd notice your period wasn't coming and wonder if you might be pregnant. It's just the way the count is done by doctors. Someone with a really irregular cycle might conceive a bit later or earlier than day 14, but even so, this doesn't stretch back to late June. Plus, sperm from sex on July 31 would have been viable in your body at least 5 days after sex.
So you went to the clinic on August 25, and based on a count beginning July 21, that would be about "day 35" of your pregnancy. That sounds like "about 5 weeks" to me.
Please write back and explain what is confusing you.