What size wire for a 100 amp sub panel in a barn?
I have a very strong sense of already having answered this question.  If this is a dupe, I apologize. 

For a 100A main breaker the smallest wire you can think of running is #1 aluminum.  

If your breaker is 100A, your largest expected load ought to be 80A.  

You do have a considerable distance there, and it's worth thinking about voltage drop.  Wire salesmen will tell you to compute voltage drop based on breaker trip and 3% drop.  You are much more correct to base it on actual expected loads and whatever drop will keep it less than 8% for all runs from main panel to final outlet. Since this will be the bulk of the run, we can give it 6% to play with, though less is nicer.  

When we do a voltage drop calc on #1 aluminum, 80A (the largest expected load allowable on a 100A breaker), 240V and 170 feet, it computes out to 2.75%.  *Well, then. We certainly don't need to bump wire size here**.  

#1 aluminum is the right stuff.