Very soon after being diagnosed with diabetes, 7-year-old Sonia Sotomayor decided she would not depend on the adults in her life — a distant, overworked mother, a doomed, alcoholic father — for the daily shots of insulin that would keep her alive.

So along with the morning routine of getting breakfast and brushing her teeth, she’d pull a chair up to the stove and boil water to sterilize a syringe and needle, measure carefully, and inject herself before leaving her South Bronx apartment for school.

In an extremely personal memoir to be published Tuesday, the 58-year-old Sotomayor writes candidly about how her life-long disease and the sense of “existential independence” she developed after the early death of her father fueled her rise from the poverty of the projects to the exclusive enclave of the Supreme Court.

“My Beloved World,” which is being published in English and Spanish, will reintroduce the nation to the first Latina justice — her publicity blitz includes a profile on “60 Minutes,” a sit-down with Oprah Winfrey, excerpts in People magazine and a national tour. She received an advance of nearly $1.2 million.

The book does not deal with her three years on the Supreme Court — she warns readers not to try to divine how her personal views inform her jurisprudence — and tells the story of her life only until her appointment to the federal bench 20 years ago.

One of the reasons for writing it, she said in a recent interview in her light-filled chambers at the court, is that “there are so many people with pieces of my story that they identify with and give them hope.

“I needed to honor that expectation in some way, and [show] it was a role that could be important for a Supreme Court justice.”

She reveals that her disease nearly took her life more than once and that part of the reason she never had children was a fear she would not be around to raise them. She writes frankly that her independence played a role in the amicable break-up of her marriage to her high-school sweetheart, Kevin Noonan (although she remains hopeful there will be another serious relationship in her life).

If her story is in many ways a familiar American tale of self-reliance and ambition, starting with the desire to win the gold stars dispensed by a fifth-grade teacher, the setting stands apart.

There’s the tiny Bronx apartment where her Puerto Rican-born parents spoke only Spanish and her father, Juan, drank himself to death behind a closed bedroom door. There were her beloved grandmother’s Saturday night parties, filled with food and music and ending with a velada, or seance. There was a poor but tightly woven community so contained that Sotomayor did not venture into Manhattan until she was in high school.

It is also a modern story in ways that are rarely associated with Supreme Court justices.

Sotomayor’s mother, Celina, a nurse, moonlighted at a methadone clinic. A brilliant but fragile cousin Nelson was addicted to heroin and died of AIDS complications; she realized just before his death she had unwittingly once driven him to score drugs.

Sotomayor writes about how her future mother-in-law deduced from an early-morning phone call that her son and Sotomayor were “sleeping together,” and that a wedding-night present from Noonan’s friends was a bag of quaaludes, which she insisted he flush down the toilet.

She notes that affirmative action is responsible for her admission to Princeton University and Yale Law School and that being Hispanic helped in her judicial ambitions. Being valued as a Latina, she writes, was a welcome change from the many times in her life she had been referred to by an anti-Hispanic slur.

She mentions often in the book worrying that she was outmatched intellectually by classmates and colleagues, but confident that she could overcome any deficit by buckling down, working harder, studying longer.

“I came to accept during my freshman year that many of the gaps in my knowledge and understanding were simply limits of class and cultural background, not lack of aptitude or application as I’d feared,” she writes. “I honestly felt no envy or resentment, only astonishment at how much of a world there was out there and how much of it others already knew. The agenda for self-cultivation that had been set for my classmates by their teachers and parents was something I’d have to develop for myself.”

After disappointing grades her freshman year at Princeton, Sotomayor bought grammar books and vocabulary texts and practiced each lunch hour at her summer job. She eventually flourished, winning Princeton’s top academic prize and graduating with highest honors, summa cum laude.

“When I’d finally looked up the translation of the Latin phrase, the irony of my needing to do so was not lost on me,” she writes.

Later, at Yale, a recruiter for a high-profile Washington law firm told Sotomayor that the problem with affirmative action was that “you have to wait to find out whether the person is qualified.”

Sotomayor filed a complaint, and the resulting controversy nearly led to the firm being disinvited to interview at the law school.

Sotomayor writes: “When the anger, the upset, and the agitation had passed, a certainty remained: I had no need to apologize that the look-wider, search-more affirmative action that Princeton and Yale practiced had opened doors for me. That was its purpose: to create the conditions whereby students from disadvantaged backgrounds could be brought to the starting line of a race many were unaware was even being run.”

The awards she had accumulated “were not given out like so many pats on the back to encourage mediocre students. These were achievements as real as those of anyone around me.”

The sentiments are strikingly different from those held by Sotomayor’s colleague on the bench, Justice Clarence Thomas, who was also admitted to Yale Law under an affirmative action program and graduated five years before her. Both will probably have more to say later this term when the court rules on University of Texas admission policies that consider a student’s race as one of several factors.

Thomas is a fierce opponent of race-based admissions, convinced, as he wrote in his own deeply personal memoir, “My Grandfather’s Son,” that it cheapens the accomplishments of minorities by implying they need special help.

“It was futile for me to suppose that I could escape the stigmatizing effects of racial preference, and I began to fear that it would be used forever after to discount my achievements,” Thomas wrote.

Sotomayor is cautious and deliberate when asked in the interview how she and Thomas could have such opposite views of programs that both experienced.

“I think every individual is different about what they” — she paused — “what they focus on. And I think my life approach is never to look at the negative of what I’m experiencing but also always trying to see its positive.”

But in the book and interview, Sotomayor acknowledged occasionally battling her own sense that she is undeserving.

“Impostor syndrome — a touch of it,” she said in the interview. “I say a touch of it because true impostor syndrome keeps people from success. I don’t think it’s kept me from success.

“But I think it’s hard to experience what I have, not the least of which the attacks I experienced during the nomination process to the Supreme Court, without some of it seeping in. And you have to, yourself, come to grips with that. I’m different, but so are all of us.”

Sotomayor can be imposing and stern on the bench, a dominating questioner who at times seems to try her colleagues’ patience. She acknowledges an intensity “that can be forbidding to people.”

But in person she laughs easily, and after writing such a frank book — they are her words, she said, compiled over three of the court’s summer recesses with help from editors but no ghostwriter — she does not hesitate to answer personal questions. She has an international network of friends, mentors, family and godchildren, and she entertains at poker parties at her new place near U Street. It is the closest thing she could find in Washington to New York’s East Village.

She hates being thought of as a workaholic. “My definition of a workaholic is someone who gets enjoyment only from work,” she said in the interview. “That’s not true for me. . . . I love life, and I love people and I love experiences.”

In the book, Sotomayor describes a scary series of incidents when she blacked out due to blood sugar imbalances, and once she was discovered by friends unconscious in an Italian hotel room. But monitoring her health has become second nature — she might give herself injections five or six times a day — and she said she no longer worries she will die young.

“When I reached 50, I was able to let go of that demon,” Sotomayor said in the interview. “But not without recognizing its benefits. It drove me in a way that perhaps nothing else might have to accomplish as much as I could as early as possible.”

The other lesson of childhood — what she called the “existential independence” she developed to a world of unreliable adults — played a role in the breakup of her brief marriage to Noonan, whom she met in high school and married after graduating from Princeton.

He told her once that he knew she loved him but that she did not “need” him.

“He wasn’t wrong about that, but it wouldn’t have occurred to me as a problem,” Sotomayor writes. “I’d never seen need as an essential part of love. . . . In retrospect, maybe I was looking at it too rationally.”

Ever practical, she sold her wedding ring to pay the divorce lawyer.

Sotomayor said in the book she still finds the idea of a relationship “alluring.” But in the interview, she said that she is not dating anyone and that she had made a vow to spend her first five years on the court concentrating on her work and the book.

“I haven’t written off the possibility,” she said. Her mother was widowed young, “found someone in her 50s and married him much later in life. So there’s still hope.”