"The Only Thing We Learn", a short story by C. M. Kornbluth, first published in Startling Stories, July 1949, available at the Internet Archive. It has been reprinted many times; any of these covers look familiar?
This story has come up here before, as the answer to the question The rise and fall of empires (cyclical barbarian invasions) set in a lecture hall, and as an unaccepted answer to the question The barbarians always win.
I remember reading a short story where the official space navy of the “Golden Empire” would only fight if hospital ships were close by, so they could be picked up and treated.
Next to him, Arris heard his aide murmur, "It's all wrong, sir. They haven't got any pick-up boats. What happens when one of them gets shot up?"
"Just what ought to happen, Evan," snapped the wing commander. "They float in space until they dessicate in their suits. Or if they get grappled inboard with a boat hook, they don't get any medical care. As I told you, they're brigands, without decency even to care for their own." He enlarged on the theme. "Their morale must be insignificant compared with our men's. When the Service goes into action, every rating and teck knows he'll be cared for if he's hurt. Why, if we didn't have pick-up boats and hospital ships the men wouldn't—" He almost finished it with "fight," but thought, and lamely ended—"wouldn't like it."
The settlers welded guns onto every possible part of their ships, disorganized and messy compared to the Imperial ships. One settler ship blew up two navy ships, and then kamikaze'd into the hospital ship, blowing it up as it exploded.
The interceptor squadron swam into the field—a sleek, deadly needle of vessels in perfect alignment, with its little cloud of pick-ups trailing, and farther astern a white hospital ship with the ancient red cross.
The contact was immediate and shocking. One of the rebel ships lumbered into the path of the interceptors, spraying fire from what seemed to be as many points as a man has pores. The Service ships promptly riddled it and it should have drifted away—but it didn't. It kept on fighting. It rammed an interceptor with a crunch that must have killed every man before the first bulwark, but aft of the bulwark the ship kept fighting.
It took a torpedo portside and its plumbing drifted through space in a tangle. Still the starboard side kept squirting fire. Isolated weapon blisters fought on while they were obviously cut off from the rest of the ship. It was a pounded tangle of wreckage, and it had destroyed two interceptors, crippled two more, and kept fighting.
Finally, it drifted away, under feeble jets of power. Two more of the fantastic rebel fleet wandered into action, but the wing commander's horrified eyes were on the first pile of scrap. It was going somewhere—
The ship neared the thin-skinned, unarmored, gleaming hospital vessel, rammed it amidships, square in one of the red crosses, and then blew itself up, apparently with everything left in its powder magazine, taking the hospital ship with it.
There was an Imperial historian, laughing as their city burned. It was because he realized the same thing would happen to the conquerors, later, as they developed an empire of their own.
. . . This was a story about centralized, decaying power and the virility of the frontier.
"It means," said the fat little man with a timbre of doom in his voice, "that they've returned. They always have. They always will. You see, commander, there is always somewhere a wealthy, powerful city, or nation, or world. In it are those whose blood is not right for a wealthy, powerful place. They must seek danger and overcome it. So they go out—on the marshes, in the desert, on the tundra, the planets, or the stars. Being strong, they grow stronger by fighting the tundra, the planets or the stars. They—they change. They sing new songs. They know new heroes. And then, one day, they return to their old home."
"They return to the wealthy, powerful city, or nation or world. They fight its guardians as they fought the tundra, the planets or the stars—a way that strikes terror to the heart. Then they sack the city, nation or world and sing great, ringing sagas of their deeds. They always have. Doubtless they always will."
"But what shall we do?"
"We shall cower, I suppose, beneath the bombs they drop on us, and we shall die, some bravely, some not, defending the palace within a very few hours. But you will have your revenge."