SAN FRANCISCO — A new memoir by Microsoft co-founder Paul Allen takes a few swipes at his former partner Bill Gates as well as Steve Ballmer, the software giant’s current CEO.

In an excerpt published Wednesday, Allen alleges that Microsoft co-founder Gates, along with Ballmer, sought to dilute his stake in the young company shortly after he was diagnosed with Hodgkin’s lymphoma in late 1982. The book is titled “Idea Man” and is slated for release on April 19; the excerpt was published on Vanity Fair’s website.

Allen writes that in late 1982, not long after he’d received his diagnosis and subsequent radiation treatment, he happened upon a conversation between Gates and Ballmer.

“I heard Bill and Steve speaking heatedly in Bill’s office and paused outside to listen in. It was easy to get the gist of the conversation. They were bemoaning my recent lack of production and discussing how they might dilute my Microsoft equity by issuing options to themselves and other shareholders,” Allen writes.

Allen confronted both men, he writes, but left before they could attempt to explain themselves.

A Microsoft spokesman declined to comment. A spokesman for Allen confirmed the accuracy of the Vanity Fair excerpt but declined to comment further.

Allen and Gates co-founded Microsoft in 1975, and the software giant’s growth has made both men extremely wealthy. Gates ranked first on the Forbes list of wealthiest Americans published last fall, with an estimated net worth of $54 billion. Allen ranked 17th on the list, with a net worth of $12.7 billion.

Ballmer placed one notch ahead of Allen, with a net worth of $13.1 billion. Allen left Microsoft in early 1983.

Gates, who remains Microsoft’s chairman, stepped back from day-to-day duties at the Redmond, Wash., company in 2008 to spend more time on his charitable work. Ballmer replaced Gates as CEO in 2000.

Allen writes in his memoir that Gates had pressed him for a larger stake in Microsoft — before the 1982 dust-up.

“I’d assumed that our partnership would be a 50-50 proposition,” Allen writes of the pair’s early days developing software, when Gates was still a student at Harvard. “But Bill had another idea.”

Gates eventually pushed for and received a 64 percent stake in the partnership, to Allen’s 36 percent, Allen writes.

Gates pressed hard for Allen to sign off on bringing Ballmer in to help run the company in its early days, even relinquishing some of his ownership stake to Ballmer to encourage him to sign on, Allen writes.

“The first time we met face to face, I thought, ‘This guy looks like an operative for the NKVD,’ ” Allen writes of Ballmer, in reference to the Soviet-era secret police force. However, Allen adds that he later grew to appreciate Ballmer’s “gentler side.”

Allen became friends with Gates when the two were at school together in Seattle. Allen writes that once, when visiting Gates’ parents’ home, Gates showed him an issue of Fortune magazine.

Gates “asked me, ‘What do you think it’s like to run a Fortune 500 company?’ ” Allen writes.

“I said I had no idea. And Bill said, ‘Maybe we’ll have our own company someday.’ He was 13 years old and already a budding entrepreneur.”