They say the suspects were caught by villagers in the Bihar state as they were trying to load a buffalo and a calf onto a lorry on Friday morning.
This is the latest in a spate of "cow vigilante" attacks that have provoked alarm among religious minorities and socially underprivileged classes.
Hindus consider cows sacred and killing them is taboo.
Three villagers were later arrested in connection with the lynching.
Critics have accused the governing Hindu-nationalist BJP of not doing enough to rein in such violence.
Several dozen people have been killed and hundreds injured in mob attacks since 2014, when the BJP came to power, but there have been convictions in only a handful of cases.
Prime Minister Narendra Modi has been criticised for not condemning the attacks quickly or strongly enough.