Thanks for the clarification Valentina,
Sounds like the offending fly larvae are from the family Calliphoridae, which are loosely termed blowflies and includes the ubiquitous greenbottle and bluebottle flies. These species are associated primarily with decomposition of organic wastes, targeting the highest nitrogen source available (meat is better than manure is better than veg), but always dead stuff. I suspect they mistook your dog for dead for some reason - perhaps he’s been rolling in manure or a carcass, as dogs love to do!?
On the compost front, yes sawdust is a good source of carbon & structure for compost. Just be careful of sawdust from sources where the timber was treated with chemicals (usually a green “CCA” dip in southern Africa, which is a highly toxic cocktail of Cyanide, copper and arsenic. Thats not good for anything living, which compost certainly is!). Other common sources of carbon are dry leaf litter, slashed grass, shredded paper/cardboard and garden waste. The rule of thumb is it should be dry and brittle, indicating that the nitrogen & bacterial components have degraded/disappeared from it.
Generally you want to aim for a ratio of 3-5 parts Carbon material as described above: 1-2 parts green/wet vegetable or food waste (microbial activity innocculum) : 1-2 parts manure or green legumes (nitrogen), either mixed or stacked in layers. The other crucial components are water (best added during the stacking process to distribute moisture evenly through the pile) and Oxygen, which is facilitated by the physical structure of the mix (ie you want to aim for a highly porous material) and the shape of the stack (more surface area = better aeration).
Alternatively, I highly suggest you investigate red wriggler earthworm and black soldier fly culture methods. These approaches are excellent for small scale, urban and household applications; small size, low labour requirement, handle consistent stream of low volumes from kitchen (but can scale up rapidly to handle larger volumes) and ability to handle concentrated “green” and food wastes rapidly. The resulting humus & liquid manure is extremely valuable in your garden, and the worms/larvae are an unbeatable fowl & fish feed. I have a DIY system at home that combines the 2 in one very simple system that requires almost no maintenance or labour. I’ll try to take some photos and maybe a sketch to illustrate this for you.