The simple answer is yes, a dirty rifle barrel can affect accuracy. Gun barrels tend to collect lead and fouling from the bullets being fired through them, and over time this can build up and start to impede accuracy.