@Derby Simon
Really sorry to hear you are struggling with your digestive system being so upset.
When do you take the Metformin. I found taking it mid meal with a significant amount of food helped protect my stomach from too much disruption from it.
It sounds like your guts are really going through a rough time and it would be wise to support them as much as possible. I would suggest prebiotics once the antibiotics are finished and plenty of fibre, particularly soluble fibre.
I take a fibre supplement drink each morning as well as eating plenty of vegetables and seeds and cut right back on my carbs and my gut health at 58yrs old is the best it has been my whole life. Supporting your gut health is important for your whole body health and mental wellbeing.
I don't think any of us can specifically say if the Metformin is the problem, but if you feel it is, then discuss stopping it and/or trying alternative medication with your GP depending upon your HbA1c levels. Obviously if they are high then you need medication.