The best comparison is: The bacteria convert free nitrogen into nitrogen-containing compounds, while the decomposers convert nitrogen-containing compounds into free nitrogen.
In the nitrogen cycle, nitrogen-fixing bacteria take atmospheric nitrogen (N₂) and convert it into ammonia (NH₃) or other nitrogen-containing compounds that can be utilized by plants. On the other hand, decomposers break down organic matter and convert nitrogen-containing compounds back into free nitrogen (N₂) gas or into ammonia, which can then re-enter the cycle.