How did the Bacteriologist know that the man who visited him was an anarchist, in the story "The Stolen Bacillus?"
A major portion of that story is focused on showing readers that scientists are so absorbed in their work that they don't anticipate its possible missuses. In other words, the story is stating that many scientists are so wrapped up in whether or not they can do something that they don't consider whether or not they should do something.
In answer to your question, the Bacteriologist does not figure out the anarchist is a an anarchist until the anarchist announces it.
"Vive l'Anarchie! You are too late, my friend, I have drunk it. The cholera is abroad!"
The Bacteriologist from his cab beamed curiously at him through his spectacles. "You have drunk it! An Anarchist! I see now."
The scientist was completely clueless that this other man came to his lab for nefarious purposes.
Even at the end of the story, it is unclear if the scientist has actually learned anything from the story. He is more upset about having to start his work all over again than he is upset about the fact that a person tried to use his work to kill millions of people.
But the bother is, I shall have all the trouble and expense of preparing some more.