This popular vote for United States Senator was technically only an advisory vote as prior to the adoption of the 17th Amendment in 1913, state legislatures officially elected United States Senators. By the time of the election in November 1912, the amendment had already been passed by Congress, but not yet ratified by the states. The Montana Legislature unanimously ratified Walsh's election on January 14-15, 1913.
Source for Popular Vote data: Montana Secretary of State. Official Vote of the State of Montana Cast at the Regular Election Held on the 5th Day of November, A.D. 1912, as Canvassed by the State Board of Canvassers, Montana Secretary of State (https://sosmt.gov/Portals/142/Elections/archives/1910s/1912_General_Statewide.pdf) (accessed 20 Sep 2023)