Q-have you got any alcohol?
A-no
Q-can I look in your bag?
Not an unlikely scenario.
You then come on here for help and you get a barrage of why did you lie to a railway person
Do remind me, which byelaw enables them to search a bag? I see nothing in the byelaws which requires you to submit to any form of search. If it's a closed bag with no obvious signs of alcohol externally, "No, not a chance!" seems like a reasonable response to the second question if it's coming from railway staff. I certainly would not be automatically inclined to permit any speculative search of my person or property by railway staff.
If it's being asked by a police officer, slightly trickier, but they still need reasonable grounds/suspicion for an involuntary search. (Hint, abuse of section 44 searches has attracted quite widespread criticism and bad PR, so they certainly shouldn't be using that to enforce alcohol.)