Most probably not. It will likely have no effect at all in determining guilt or liability, since the fact that you do volunteer work is almost certainly of no legal relevance to whatever matter is under trial and thus will not be something that you can testify to or otherwise mention at any phase during the trial. read more
In some courts, the judge may be inclined to permit you to serve all or most of the detention period on home confinement or"work release" (allowing you to go to work to protect your job). Doing community service before trial might mean the TYPE you have do is better than what the judge might order during sentencing. read more