Is it The Sun and I"The Sun and I" by K. J. Parker?
“We could always invent God,” I suggested.
We’d pooled our money. It lay on the table in front of us; forty of those sad, ridiculous little copper coins we used back then, the wartime emergency issue—horrible things, punched out of flattened copper pipe and stamped with tiny stick-men purporting to be the Emperor and various legendary heroes; the worse the quality of the die-sinking became, the more grandiose the subject matter. Forty trachy in those days bought you a quart of pickle-grade domestic red. It meant we had no money for food, but at that precise moment we weren’t hungry. “What do you mean?” Teuta asked.
“I mean,” I said, “we could pretend that God came to us in a dream, urging us to go forth and preach His holy word. Fine,” I added, “it’s still basically just begging, but it’s begging with a hook. You give money to a holy man, he intercedes for your soul, you get something back. Also,” I added, as Accila pursed his lips in that really annoying way, “it helps overcome the credibility issues we always face when we beg. You know, the College accents, the perfect teeth.”
The students do have several "miracles" attributed to them (some through dumb luck, some through careful planning and foreknowledge). The protagonist tries to reveal the religion's nefarious origins after
the "made-up" god appears to him in a dream
and is eventually excommunicated from the religion for it. He wanders the desert, eventually returning to the city where he founded the religion, being sentenced to death for heresy, and thereby being "martyred" for his schismatic beliefs.
However his execution turns out to be staged by his friends still in the religion, who actually control both the Orthodox and schismatic sects, and his friends give him a generous pension and allow him to retire in peace.
Found by sheer 100% dumb luck as I scrolled through the "Recommended Stories" section of Free SF Online, linked in the comments by @user108131.