A member of Meath County Council from 1959, Farrelly was chairman of the North-Eastern Health Board from 1971 until his death. He stood unsuccessfully as a Fine Gael candidate for Dáil Éireann in the Meath constituency at the 1954 general election and at a by-election in 1959, before winning the seat at the 1961 election. He was re-elected in 1965, but defeated at the 1969 general election. He stood again in 1973, but was not elected.
After the loss of his Dáil seat 1969, he was elected to the 12th Seanad Éireann on the Industrial and Commercial Panel. He was returned in 1973 to the 13th Seanad, and died in office in 1974, aged 62.