The Engineer of Record should make decisions regarding valve and pipe material compatibility and the application of dielectric unions. The information below is for reference only.
The risk of galvanic corrosion can be quantified by determining the difference in anodic indexes for the dissimilar metals. A common summary of these indexes can be found on various websites, such as www.engineersedge.com.
Regarding this question, 300 series stainless steels (18% chromium) have an anodic index near 0.50V and carbon steels have an anodic index near 0.85V. This gives us a difference of 0.35V. Outdoor applications should not have an anodic index difference more than 0.15V, applications for unconditioned indoor spaces should not exceed 0.25V, and climate controlled spaces can tolerate up to 0.5V difference.
A stainless steel valve should not be electrically connected (i.e. without a dielectric) to carbon steel piping in an unconditioned space, but shouldn’t cause any problems in a climate controlled space. Further, since carbon steel is more anodic than stainless steel, the carbon steel will be the material to oxidize. Since the mass of the carbon steel will be much greater than the mass of the stainless steel in the system, the rate of corrosion (if any) will be extremely slow.