If Tycho Brahe in Kepler's Somnium in Laurel's answer doesn't count because he was too early and pre scientific I have some more recent examples to suggest.
In Robert a. Heinlein's "Requiem", Astounding Science Fiction, January, 1940 Delos D. Harriman remembers his boyhood dream of studying Astronomy under Moulton at the University of Chicago and working for Dr. Frost at the Yerkes observatory.
Forrest Ray Moulton (1872-1952) was Professor of Astronomy at the University of Chicago from 1896 to 1926, and Edwin Brant Frost was director of the Yerkes Observatory from 1905 to 1932.
How old was Delos D. Harriman in Heinlein's "Requiem"?
My answer to this question
First story to mention the speed of light?
shows that Albert Einstein (1879-1955) was mentioned at least two times in the first publication of The Skylark of Space in 1928.
Garrett Putnam Serviss (March 24, 1851 – May 25, 1929) was an American astronomer, popularizer of astronomy, and early science fiction writer. Serviss was born in Sharon Springs, New York1 and majored in science at Cornell University.
And fortunately, the Wikipedia article on Serviss identifies his mention in an early Lovecraft story.
A quotation from Serviss' Astronomy with the Naked Eye (1908) appears at the end the short story Beyond the Wall of Sleep (1919) written by H. P. Lovecraft.4
The most famous science fiction novel by Serviss was probably:
Edison's Conquest of Mars, 1898 novel (written on commission from The Boston Post as a sequel to "Fighters from Mars", an un-authorized and heavily altered version of H. G. Wells' The War of the Worlds)
https://en.wikipedia.org/wiki/Garrett_P._Serviss
In Edison's Conquest of Mars Earth strikes back against the Martians.
An early example of what would later be called space opera,2: 69 Edison's Conquest of Mars was also a particularly literal "Edisonade". The book contains some notable "firsts" in science fiction: alien abductions, spacesuits (called "air-tight suits": see Spacesuits in fiction), aliens building the Pyramids, space battles, oxygen pills, asteroid mining and disintegrator rays.4
Serviss wrote himself into the story as a professor whom Edison consults; also appearing are scientists such as Edward Emerson Barnard, Lord Kelvin, Wilhelm Röntgen, and Silvanus P. Thompson, and heads of state such as Queen Victoria, U.S. President William McKinley, Kaiser Wilhelm II, and Emperor Mutsuhito.1
https://en.wikipedia.org/wiki/Edison%27s_Conquest_of_Mars
Edward Emerson Barnard lived from 1847-1923, Lord Kelvin from 1824-1907, Wilhelm Rontgen from 1845-1923, and Silvanus P. Thompson from 1851-1916.
I find it easy to believe that some of the characters in some of Jules Verne's more science fictional novels might have mentioned the observations and theories of some real contemporary scientists. But I don't remember any examples.
Edgar Allen Poe's story "Mellonta Tauta" (1849), consisting of letters supposedly written in 2848, mentions famous German astronomer Johann Heinrich Madler (1794-1874) in this passage:
April 6.—Last night had a fine view of Alpha Lyrae, whose disk, through our captain's spy-glass, subtends an angle of half a degree, looking very much as our sun does to the naked eye on a misty day. Alpha Lyrae, although so very much larger than our sun, by the by, resembles him closely as regards its spots, its atmosphere, and in many other particulars. It is only within the last century, Pundit tells me, that the binary relation existing between these two orbs began even to be suspected. The evident motion of our system in the heavens was (strange to say!) referred to an orbit about a prodigious star in the centre of the galaxy. About this star, or at all events about a centre of gravity common to all the globes of the Milky Way and supposed to be near Alcyone in the Pleiades, every one of these globes was declared to be revolving, our own performing the circuit in a period of 117,000,000 of years! We, with our present lights, our vast telescopic improvements, and so forth, of course find it difficult to comprehend the ground of an idea such as this. Its first propagator was one Mudler. He was led, we must presume, to this wild hypothesis by mere analogy in the first instance; but, this being the case, he should have at least adhered to analogy in its development. A great central orb was, in fact, suggested; so far Mudler was consistent. This central orb, however, dynamically, should have been greater than all its surrounding orbs taken together. The question might then have been asked—"Why do we not see it?"- we, especially, who occupy the mid region of the cluster—the very locality near which, at least, must be situated this inconceivable central sun. The astronomer, perhaps, at this point, took refuge in the suggestion of non-luminosity; and here analogy was suddenly let fall. But even admitting the central orb non-luminous, how did he manage to explain its failure to be rendered visible by the incalculable host of glorious suns glaring in all directions about it? No doubt what he finally maintained was merely a centre of gravity common to all the revolving orbs—but here again analogy must have been let fall. Our system revolves, it is true, about a common centre of gravity, but it does this in connection with and in consequence of a material sun whose mass more than counterbalances the rest of the system. The mathematical circle is a curve composed of an infinity of straight lines; but this idea of the circle—this idea of it which, in regard to all earthly geometry, we consider as merely the mathematical, in contradistinction from the practical, idea—is, in sober fact, the practical conception which alone we have any right to entertain in respect to those Titanic circles with which we have to deal, at least in fancy, when we suppose our system, with its fellows, revolving about a point in the centre of the galaxy. Let the most vigorous of human imaginations but attempt to take a single step toward the comprehension of a circuit so unutterable! I would scarcely be paradoxical to say that a flash of lightning itself, travelling forever upon the circumference of this inconceivable circle, would still forever be travelling in a straight line. That the path of our sun along such a circumference—that the direction of our system in such an orbit—would, to any human perception, deviate in the slightest degree from a straight line even in a million of years, is a proposition not to be entertained; and yet these ancient astronomers were absolutely cajoled, it appears, into believing that a decisive curvature had become apparent during the brief period of their astronomical history—during the mere point—during the utter nothingness of two or three thousand years! How incomprehensible, that considerations such as this did not at once indicate to them the true state of affairs—that of the binary revolution of our sun and Alpha Lyrae around a common centre of gravity!
https://en.wikisource.org/wiki/Mellonta_Tauta
https://hsm.stackexchange.com/questions/12911/was-the-sun-assumed-to-be-at-rest-aether-frame/12914#12914
Poe's future character calls Madler Mudler.
In Jonathan Swift's Gulliver's travels (1726) there is mention of the law of gravitation in the account of Laputa:
They have likewise discovered two lesser stars, or satellites, which revolve about Mars; whereof the innermost is distant from the centre of the primary planet exactly three of his diameters, and the outermost, five; the former revolves in the space of ten hours, and the latter in twenty-one and a half; so that the squares of their periodical times are very near in the same proportion with the cubes of their distance from the centre of Mars; which evidently shows them to be governed by the same law of gravitation that influences the other heavenly bodies.
https://www.gutenberg.org/files/829/829-h/829-h.htm#part03
But Swift doesn't name Sir Isaac Newton (1642-1726/27), so that doesn't count.
And those are the examples I could think of at the moment.
Added 02-16-2023:
In Poe's "The Thousand and Second Tale of Scheherazade", Godey's Lady's Book, February 1845, The eighth voyage of Sinbad is described. And there are notes explaining that that the strange wonders Sinbad describes are actually known to (then) modern science.
Another of these magi constructed (of like material) a creature that put to shame even the genius of him who made it; for so great were its reasoning powers that, in a second, it performed calculations of so vast an extent that they would have required the united labor of fifty thousand fleshy men for a year.[22]
Babbage's Calculating Machine.
Charles Babbage (1791-1871)
https://en.wikisource.org/wiki/The_Works_of_the_Late_Edgar_Allan_Poe/Volume_1/The_Thousand-and-Second_Tale_of_Scheherazade
So if the notes were in the first publication, Charles Babbage was mentioned in a humorous science fiction or fantasy story in 1845.
Added 02-14-2023.
User14111's answer mentions Sir John Herschel as the the alleged discover of life on the Moon in "The Great Moon Hoax". Does "the Great Moon Hoax" count as science fiction?".