When I took economics courses (before the glaciers descended and dinosaurs ruled the earth), it was absolutely, positively not the case that most of my economics profs were either libertarian or cosmopolitan. Most of them were ordinary New Deal Democrats. There may have been a Marxist or two.
In a recent NYT op-ed, quoted at his blog Tyler Cowen tries to make a case that the field of economics tends to attract individuals who are libertarian and cosmopolitan in predisposition. He cites several different economists from different centuries who are, indeed, notably libertarian.
In making this assertion he commits sociology. I believe it is possible to know everything there is to know about economics without knowing anything about the sociology of the field of economics. If for every historical example he gives of a libertarian economist there is a counter-example of another economist who is not a libertarian, what becomes of his thesis? That he does not cite non-libertarian economists does not prove that they did or do not exist. It only suggests confirmation bias. Is Paul Krugman notably libertarian?
I think, contrariwise, that as with the other social sciences economics attracts individuals who are interested in influencing human behavior and by influencing human behavior having an effect on the future. That means that those fields tend to attract progressives. I would be willing to bet a shiny new dime that for every libertarian economist teaching in U. S. institutions of higher education today there are five progressive economists. Maybe more.