Well, you can certainly TRY, but "detention" is often a disciplinary matter involving the contract between student and institution-- so if it is for a behavioral infraction involving your child's choices/behavior, unless you have a disability-related or matter-of-conscience angle, it may make little difference.
So things where parental backing is both entirely appropriate and would probably stick:
a) child has a documented physical disability which prevented him/her from complying with a substitute teacher's order to do (whatever-it-was), or
b) refusal to dissect an animal in a child who is vegan.
(Those are just examples, of course)
Grey area:
a) child says that teacher was unfair-- and you believe it is probably true, or
b) child was "swept" up in a Draconian punishment intended to punish a whole group of children ("the entire 6th grade").
If your child has an IEP or 504 plan, you probably have better leverage.