Sounds v similar to my ds1. He was ebf I had to cut dairy out of my diet as it was giving him wind. We weaned him and the constant diarrhoea started. The doctor did a poo test and he was found to be lactose intolerant. We went onto Sma lf it helped but not cured. We were referred to nutritionist, turns out he was cows milk intolerant which is common and they grow out of usually
Mostly all his milk still came from me but we used the formula with food and for one feed at nursery. It still wasn't right so at one we moved onto alpro soya junior, cut all dairy out and Never looked back.
He's now 4 and we've re introduced dairy as he grown out of it. My son despite the constant diarrhoea never lost weight, continued to grow in line with his centiles. He also was not small.
If I read your thread right your doctors referred you but has he done the poo test himself? You drop it off at the Gp and it takes a few days for the result. Could he do this whilst waiting for the referral?
The chid does need to have eaten milk for a result.