Maggots in veg patch
New to this site and gardening. We've just started a vegetable patch and were quite excited about this. We moved into a new build house so when we removed the turf the builders put down we found we had terrible soil and were convinved nothing would grow. It's full of stones (mostly limestone from the builders) and is a heavy clay soil. To improve the soil quality in the beds we were advised to use an organic farmyard muck first and dig this in well, which we did. Then we had some rich organic compost for the top which we covered the surface with.
Into this which looked good we then planted on one side; radish, little gem, courgette and i bought a butternut squash plant in the garden centre. All was going well for about 3 weeks. Then i started to notice the radish dying. Last night i also noticed one of the seedlings for the courgette had died, i pulled at the seeding to remove it and lots of maggots came out. I then checked the radish and the same thing appears to have happend. The stem and roots of the butternut squash had also died and were covered in maggots.
What have we done wrong? Has the smell of the muck attracted flies which have laid eggs, which is what i presume. But how do i now get rid of the eggs which i presume are in the soil. Also is it just a matter of time before my little gems are attacked.
Final question, my second bed, which is separated by a sleeper seems fine, but am i just kidding myself and will my tomatoes soon die as well.
Can you offer me some practical advice on how to deal with this issue...