If you're a US MD, and you don't want one of the top IM programs, then you don't even need any research to match somewhere.
Research never hurts, but obviously it'd be good to have research in the field you're expecting to go into. However, most PDs know med students change their minds about specialties during med school, so it's not like they'll penalize you for doing research outside your eventual chosen specialty. For example, if you did research in surgery, but then realized you didn't want surgery, then applied for IM, most IM PDs probably wouldn't care that your surgery research isn't IM related. Most likely they'd either be neutral or they would be positive about you being able to start a project and publish it (e.g., case report, poster, paper).
Of course, research helps for competitive IM fellowships.