Hi
It seems like you are suffering from orchitis associated with constipation.
Orchitis is the inflammation of the testis and is usually bacterial in origin. Orchitis can cause pain in the groin especially if prolonged pressure is applied due to increased physical activity. Moreover, most of the cases are asymptomatic with only paroxysmal symptoms. I suggest you do the following,
1) Avoid sleeping on your stomach and increased physical activity as it can prevent the pressure on the groin.
2) I suggest you get a routine urine analysis and culture, to identify the causative organism. Based on the culture reports, the antibiotics can be changed later.
3) Take a prophylactic shot of Antibiotics Inj ceftriaxone single dose or tab. Cefepime single dose for 7 days.
4) Maintain a good hygiene and practice safe sexual practice.
5) Drink plenty of water and maintain a good healthy diet.
If the pain is intermittent as you have mentioned then it will improve on antibiotics and rest but if the pain becomes continuous and does not subside, I suggest you contact a surgeon immediately and get a Doppler Ultrasonography to rule out Torsion of testis, which is a surgical emergency.
Thank you.