This is done using a concept called allometric scaling.
Article A simple practice guide for dose conversion between animals and human
While allometric scaling is very useful, we do need to note that allometric scaling is done mainly via dosing by weight and may not account for the species differences in metabolism and clearance
This is quite difficult. The anatomy of digestive tract of animals differ as in ruminants, fish medicine is altogether different and the metabolism of the young animals differ from adult ones. I can think of only worm treatment where weight to weight basis dose could be adopted since in this instance the drug acts on the worms.
The dosage is the amount of medication based on units per weight of the animal (50 mg/kg, 10 mL/kg) The concentration of the drug is calculated by the manufacturer (mg/mL, mg/tablet) .
Please see https://www.producer.com/2002/03/calculating-drug-doses-animal-health/