The loose stools after a gap of few days after normal motions, foul smell, green color all suggest an infection of the intestinal tract. Ultrasonography
alone has no role.
I would advise you to take a course of an antibiotic and see the results. If the problem is solved , nothing more is needed. You have to avoid the reinfection by the Waterborne diseases
If no relief, go for the following tests: Blood, urine and stool tests.
Colonoscopy and biopsy
CT scan of the abdomen. Gastrointestinal cancer
has to be ruled out as is the possibility of Tuberculosis