Supreme Court Justice Ruth Bader Ginsburg on Monday appeared in good spirits as she accepted an honorary law degree from the University of Buffalo — her first public appearance since undergoing treatment for pancreatic cancer.

The 86-year-old made only a brief reference to her cancer scare, noting that she decided not to withdraw from the ceremony “when my own health problems presented challenges.”

Standing at a podium at the SUNY school, Ginsburg addressed her hero status among young liberals, which has spawned memes and a recent documentary.

“It was beyond my wildest imagination that I would one day become the Notorious RBG,” Ginsburg said, referencing her nickname, a reference to late Brooklyn rapper Notorious BIG.

“I am now 86 years old and yet people of all ages want to take their picture with me — amazing,” Ginsburg added, sparking laughs from the audience.

The Brooklyn-born justice then did a 30-minute question-and-answer session, where she touched on her relationship with late Justice Antonin Scalia, her role as the senior liberal on the bench and her early work to fight gender discrimination.

She said two women who inspired her as a youngster were famed aviator Amelia Earhart and fictional teen detective Nancy Drew.

The appearance came just days after the Supreme Court announced that Ginsburg had undergone a three-week course of radiation treatment at Manhattan’s Memorial Sloan Kettering Cancer Center, beginning Aug. 5, for a malignant tumor on her pancreas.

“The tumor was treated definitively and there is no evidence of disease elsewhere in her body,” the court said in a statement Friday, adding that “no further treatment is needed at this time.”

Ginsburg’s health has been in the spotlight, since her retirement or death could potentially give President Trump his third Supreme Court pick on a bench where the conservative majority stands at 5-4.

The justice, who was appointed in 1993 by former President Bill Clinton, missed oral arguments for the first time in January after she underwent surgery to remove two cancerous growth from her lungs in late December.

She also had two previous bouts with cancer in 1999 and 2009.

Later Monday evening, Ginsburg is set to give a sold-out speech to an audience of more than 2,000 people at the Kleinhans Music Hall in Buffalo.

With Post wires