Elizabeth is being very sarcastic when she says the line above. She speaks the line while conversing with her Aunt Gardiner in Gracechurch Street. She traveled to Gracechurch Street with Sir Lucas and his second eldest daughter Maria en route to Kent to visit Charlotte in her new home with Mr. Collins at Hunsford. However, immediately before leaving Longbourn, Wickham became engaged to Miss King who recently inherited £10,000. Before Elizabeth speaks these lines, she and her aunt are conversing about whether or not Wickham has shown himself to be mercenary and Miss King has shown herself to be foolish. Mrs. Gardiner is very concerned about Wickham only marrying Miss King for her money. However, she hesitates to think poorly of him because she knows he grew up in Derbyshire, her own home county, along with Mr. Darcy. Hence, Elizabeth is speaking of Mr. Darcy and Mr. Bingley, who has just slighted Jane, when she replies, "I have a very poor opinion of young men who live in Derbyshire; and their intimate friends who live in Hertfordshire are not much better" (Vol. 2, Ch. 27). Her lines show the resentment she feels towards both men.
She next says:
Thank Heaven! I am going to-morrow where I shall find a man who has not one agreeable quality, who has neither manner nor sense to recommend him. Stupid men are the only ones worth knowing, after all. (Ch. 27)
In these lines, she is referring to Mr. Collins. It is Mr. Collins she sees as wanting both sense and manners and being very stupid. However, she is making the sarcastic claim that "stupid men are the only ones worth knowing" because so far he is the safest man she has met. He has slighted no one; he has not proved to be mercenary; his only fault is his ridiculousness. Hence, again, her sarcasm in this particular line shows her bitterness towards the three men she has met recently.
However, interestingly, throughout the rest of the story Elizabeth's sarcastic line does not prove to be true. Later, both Mr. Darcy and Mr. Bingley prove themselves to be very much worth knowing, and Mr. Collins proves himself to be not worth knowing at all when he writes a letter slandering the reputation of all the Bennet daughters after Lydia's elopement with Wickham.