Research will never hurt you.
Research outside of your desired specialty can be justified by stating that you found a great mentor, wanted to learn the basics of research, etc. The fundamentals of research can be applied in any field.
A CV with research on it beats a CV without research on it pretty much every time.
Yes, research in your desired specialty is ideal, however taking a year off for such an effort needs to be a decision rooted in your application as a whole. I would do it if you wanted to build a relationship with a big wig in the specialty, if you lacked people to write you good letters of recommendation in the field, you really wanted to go to one program (location of your extra research year), or if your application is lacking in other aspects such a board scores.