Mr Yadav said he had left New Delhi by Duronto Express.
The Ghaziabad police had already intimated him that he would not be allowed to reach Allahabad and would be detained at Ghaziabad itself, Mr Yadav told PTI.
He was taken to a state administration guest house from the Ghaziabad station, he said.
However, there was no word from Ghaziabad police on the incident.
The JD(U) leader said he was surprised at the state administration's decision to detain him as it was a normal programme by some social groups in Allahabad which he was going to attend.
JD(U) General Secretary Javed Raza said Mr Yadav was going to participate in an all-India level programme on the issue of reservation in Allahabad's KP College organised by Samajik Nyay Morcha, which is a group of pro-reservation students.
The detention of Sharad Yadav came a day after violence broke out in Allahabad during protests against the new reservation policy by the Uttar Pradesh Public Service Commission. Youths went on a rampage pelting policemen with stones, vandalising dozens of vehicles and shops and raising slogans against the Commission and the state government.