IBS can present with either constipation or diarrhoea and sometimes both. It could be the reason for your abdominal pain.
Next Steps
Please consult a surgeon or gastroenterologist for evaluation and management.
Health Tips
If your issue is temporary and not affecting your daily routine you can try something called as a FODMAP diet that is easily available online.