I have read a lot about Popper but I still can not answer. What is the role of values in Popper's philosophy? What role do they have in science according to Popper?
Popper followed logical positivists (despite arguing with them on other issues) in separating “statements of empirical science from non-empirical statements”, the so-called demarcation. Therefore values, being non-empirical, do not enter the science proper, and after Kuhn Popper fiercely resisted all postmodernistic claims to the contrary. But positivists also took the demarcation to imply the fact-value dichotomy, with values being subjective and emotive, expressing individual attitudes and feelings, not anything objective or factual. Since Popper himself advocated for certain political and social values, more or less those of Western liberal democracy, e.g. in The Open Society and Its Enemies, this positivist dismissal of ethics and metaphysics was not suitable for him. He was more circumspect and softened the fact-value dichotomy and its consequences in his theory of three worlds. Here is a brief description from Germino's The Fact-Value Dichotomy as an Intellectual Prison:
"As described by Sir John Eccles, who follows Popper in endorsing the third-world construction, “World 1” represents physical objects and states; it is the “total world of the materialists.” “World 2” consists of states of consciousness and subjective knowledge. “World 3” represents the “whole world of culture,” or knowledge in the “objective sense”. For both Eccles and Popper there is a reality resulting from the interaction of objectivity and subjectivity which is not explainable by the fact-value dichotomy. Popper calls the third world the realm of “epistemology without a knowing subject.
Not surprisingly, Popper attempts to positivitize, as it were, the contents of his third world, calling it the realm of “objective knowledge.” In this way, World 3 can fall mainly on the positive side of the line of demarcation and count as something empirical and objective, even though it perforce contains elements of subjectivity. Thus, even “poetic thoughts and works of art” are subsumed under World 3, which comprises the “world of objective contents of thought."
The third world is supposed to be made by humans, but transcend its makers, express subjective and historical developments, but through objective content. It is unclear how well Popper managed to square this circle:
"Popperian man is pictured as “facing” a phenomenal reality external to him upon which he projects his “values” and in interaction with which he creates a “third world” of culture or “objective knowledge.” Thus, he describes his third world as a “man-made product... In Objective Knowledge Popper even cites the very Plato he had so mercilessly savaged in his open society book as the philosopher who, for all his “essentialist” errors, might lead us back to a language of the reality not accounted for in the language of values. Struggle as he does, however, Popper cannot bring himself to break through and reenact within himself Plato’s experience of the reality of human existence in the Metaxy or the “Between”.
For all his attempts at revising the inadequacies of the fact-value language, Popper’s man remains “facing” the reduced “reality” of the neopositivists. All he has accomplished is to have added a realm of cultural “facts” (in the creation of which his Pelagian-like individuals have had a share through their self-conscious interaction with the physical world and with the realm of “objective” knowledge) to the physical “facts” of the positivists."
The difficulties Popper faced are not unique to him, and have to be dealt with by all philosophers who favor naturalism. Naturalistic picture of the world ostensibly makes ethical values illusory and moralistic explanations redundant. Thus, unless they accept eliminativism about values, they must look for the Metaxy, the middle ground from Plato's Symposium, a place for values that is not supernatural, like Plato's reified Highest Good.
More recently, McDowell attempted another such Metaxy in his idea of man-dependent, but non-subjective, "second nature" (borrowed from Aristotle), which is somewhat reminiscent of Popper's "third world", but far more elaborate. Still, McDowell's "second nature" faces similar objections and criticisms, see Bransen's On the Incompleteness of McDowell’s Moral Realism.
Popper explains the role of values in science in "The World of Parmenides" Essay 2 Addendum 2. Popper points out that there are no authoritative sources of knowledge: everyone makes mistakes including scientists. Scientists should look out for their own mistakes, and the mistakes of others. They should should be grateful when mistakes are pointed out and should never cover up mistakes. the alternative to such conduct is to keep making the same mistakes repeatedly, which is not a good idea.
One of the other answers sez stuff about the fact-value dichotomy: the idea that you can't derive moral ideas from facts. But Popper's epistemology sez you can't derive any theory from facts. Rather, all theories are created by proposing solutions to problems guesses and controlling them by criticism. So the fact that you can't derive moral theories from facts is irrelevant to their status since it doesn't distinguish moral knowledge from any other kind of knowledge. See "The Beginning of Infinity" by David Deutsch, Chapter 5 for a discussion of this issue.