Call Me Maelzel by Don Trotter

Call Me Maelzel by Don Trotter1 (F&SF, August 1976) gets off to a lively start with a ship AI called Maelzel pranking one of the crew:

I could hear water splashing on the deck in Lloyd’s shower, then the slap of his feet on the wet tiles. I had planned to zap him right away, but he started singing in his wheezy tenor that song about the sailor who’s spent a year and a quarter in his ship’s crow’s-nest and he goes up the river to see Budapest… but you probably know it. “Yardarm Arnie?” Anyhow, it’s a particular favorite of mine, and it sounded kind of nice echoing around in Lloyd’s shower stall. So I let him finish first, and on the final “…mizzen mast, tooooo!” I cut off the hot water and ran up the pressure on the icy as high as it would go. Exit Lloyd, raging wet.
“Goddarnit, Mazey! This time…” he started in, mad as a kicked kitten.
I hit the decompression warning in his cabin, a basso profundo WHOOT! WHOOT! that totally drowned him out. I think he might have called my bluff, but for realism I dropped the air pressure a little, just enough to make his ears pop, and let the emergency airbag fall from its recess in the ceiling. It was as convincing as hell, if I do say so myself.  p. 78

When Lloyd makes it to the muster station he is only wearing a pair of soaking wet shorts under a transparent airbag, and is then subjected to the stares of the rest of the (unpranked) crew. They subsequently vote Maelzel into “Durance Vile” (limbo) for one day.
While Maelzel is disconnected from everything apart from the emergency systems, we get some backstory about the AI and learn that, because of a previous mission which ended in disaster, Maelzel has been, like the ship, hugely overspecified. This means Maelzel is underemployed, bored, and consequently needs to finds ways to entertain itself.
After Maelzel is released from limbo he gets up to his tricks again, this time slowly increasing the gravity and making the crew think about diets and exercise. When they find out about this some days later, they are just about to throw Maelzel back into Durance Vile when they are attacked by pirates. Of course, none of them believe Maelzel’s warnings until just before they are boarded, by which time it is too late:

At each of the four cardinal points of the lounge a tall skinny character appeared, back to the bulkhead, little round shield and big swashbuckling cutlass poised, ready to slay dragons or die trying. At the sight of my crew strewn all over the carpet they relaxed their defensive attitudes, and a couple of them started laughing. The one over by the aquarium, apparently the leader, swaggered over to where Sash was lying, half stunned, against the bar. He poked him with his cutlass.
“On your feet, reptile,” he said without rancor. Sash climbed slowly to his feet, then, with apparent effort, put his grin back in place. He looked his captor in the eye, then returned the careful eying the other was giving him.
Our uninvited guests were worth looking at. Two men and two women, each a shade under seven feet and several shades under two hundred pounds, they were as bald as a bar of soap and naked as a porno flick; nude, but not lewd, they were tattooed. All over. The one holding his cutlass at Sash’s throat had his musculature done in bright red and fine detail, from quadriceps and biceps down to the tiniest facial muscles. He looked like an anatomy chart, or like St. Bartholomew after the Armenians finished flaying him. The lady with her foot on the lens of my best holo projector was done up like a Gila monster, in black and orange pebble pattern, with each pebble carefully shaded to look raised. Black, whole-eye contacts made her eyes appropriately shiny and beady. I wondered how she felt about St. Bartholomew calling Sash “reptile.” The man down by where the fountain splashed into the pool was mostly in bare skin and tattooed zippers — some of which were partly unzipped to show right lung and liver, one temporal and both frontal lobes of his brain, and selected other bits of his internal workin’s, all in five colors and exquisite detail. The woman who had joined St. Bart in front of Sash was done over in spiders — big ones, little ones, hairy and smooth, they swarmed up her arms, legs, and torso (two enormous tarantulas cupped her breasts), all exact trompe l’oeil. If she’d been ticklish, she wouldn’t have lasted two minutes. Her head was done in furry black, with pairs of iridescent patches to match the contacts she wore, the locations of the false eyes being characteristic of the Latrodectus genus: the Widows, black and other colors.  pp. 84-5

That’s a passage that would grace a modern day issue of Planet Stories.
After an initially peaceable takeover, St. Bartholomew gropes Tilly, one of the crewmembers, and Sash gets slashed open when he tries to protect her.
The rest of the story sees the crew try to get Sash to sick bay, while avoiding mentioning Maelzel by name (to leave the AI with the element of surprise). Then (spoiler), when the pirates start wandering around the ship, Maelzel picks them off one by one (the first of the victims gets spaced through one of the ship’s toilets!)
If you are looking for a colourful and entertaining space opera with AIs and space pirates,2 then this will be right up your street.
*** (Good). 6,850 words. Story link.

1. According to ISFDB, Don Trotter only published three stories. On the basis of this one that is a pity.

2. This story reminded me of another recent AI/pirates tale, Knock, Knock Said the Ship by Rati Mehrotra (F&SF, July-August 2020).