Montana had a huge influx of Southerners at one point, that propelled a lot of early Democratic strength in the state. Whereas the Dakotas, or at least North Dakota in particular was settled by a combination of Yankees, Germans and some Scandanavians and thus favored the Republicans (save for daliances with the Populists, TR and the FDR in the Great Depression), until about the 1950's, when the Democrats began to gain strength.
Yankees, Germans, and some Scandinavians?
North Dakota is the most Scandinavian state in the union. The state is 47% German background, 30% Norwegian, and 5% Swedish.
Irish make up just under 8% and English 4%.
Yankees made up a very small part of the settlement there. It was almost exclusively Germans and Scandinavians.
And while they were Republican, just as in Minnesota... there was a strong progressive streak that led to the rise of the non-partisan league which was Republican aligned and then later aligned with the Democrats... which is why the Democratic Party of North Dakota is called the Dem-NPL party to this day.
And to think that North Dakotan Republicans are anything like national Republicans would be a mistake. They operate much more like a Christian Democratic party of Europe than anything like the modern GOP.