Oprah Winfrey made him famous. Former president Jimmy Carter made him a friend.

Both attended the funeral yesterday of Mattie J.T. Stepanek, a Rockville boy-turned-national hero who struggled for years with a form of muscular dystrophy and wrote books of inspirational poems that climbed the bestseller charts, topping even Carter's memoir. He died last Tuesday at Children's Hospital in Washington.

The pews at St. Catherine Laboure Catholic Church in Wheaton were nearly filled to their 1,350-person capacity as family and friends -- dozens of Harley-Davidson riders, hundreds of blue-uniformed firefighters and hundreds more strangers who knew Mattie only through his television appearances and books -- came to say goodbye to this 13-year-old boy who had every reason to complain about life, and didn't.

In his eulogy, Carter told the congregation that throughout his long and varied public life, which has included shaking millions of hands, traveling to more than 120 countries and knowing "kings and queens, presidents and prime ministers," Mattie was "the most extraordinary person" he has ever known.

The former president and the boy-poet met three years ago. Mattie suffered from dysautonomic mitochondrial myopathy and depended on a wheelchair, ventilator, supplemental oxygen and blood transfusions. In summer 2001, the Make-a-Wish Foundation told Carter that "a little boy with a few more days to live" had a final wish: to meet Jimmy Carter.

"I was surprised," Carter said, speaking from the altar at St. Catherine Laboure, where a 40-foot-tall Italian stained-glass window dwarfed him and the nine, white-robed priests celebrating the Mass. Mattie was surprised, too, when Carter appeared on the set of "Good Morning America," making his wish come true.

"When I walked into the room, he thought it was a presidential impostor," Carter said. "It was the first time in his life, and maybe the only time, that Mattie was speechless. We formed an instantaneous bond."

This often-ebullient boy, both wise and mischievous, also attracted the attention of talk-show hosts Winfrey and Larry King, and many at yesterday's funeral said they first became aware of Mattie and his poetry and world views through his television appearances.

"The first time I saw him," Wheaton resident Clarissa Barclay, 49, said after the service, "I called my sister and said, 'Oprah has a boy on. They say he's 10, but I think he's 50 or 55.' " She especially appreciated his message because, she said, "I'm from Liberia, and there's been fighting in my country, and he was -- peace."

Carter, a Nobel Peace Prize recipient, spoke of just that: Mattie's devotion to peace. "He was deeply aware of global affairs," Carter said, recalling that Mattie was in Children's Hospital's intensive care unit when the war in Iraq began last year.

"Mattie burst into uncontrollable sobs and grief," Carter said, and soon after, the former president received a letter from his then-12-year-old friend: "I feel like President Bush made a decision long ago about the war," Mattie wrote. "Imagine if he had spent as much time and energy . . . planning peace."

The letter continued, "Even though I want to talk to Osama bin Laden about peace in the future, I wouldn't want to be alone with him in his cave." The congregation dissolved into laughter.

"In the same letter," Carter added, "he asked if I would join him."

At the front of the church, amid bouquets of flowers from Chicago and Boston and Toledo, were photo collages of Mattie. Nearly all showed him mugging, his smile stretched so wide that the thin oxygen tube under his nostrils was barely visible. There he was in his karate uniform and playing miniature golf, wading at the beach and posing with big, green monster claws in the bathtub. In most of the pictures, the oxygen tank on wheels is his constant shadow.

He began speaking poetry when he was 3, and his mother, Jeni Stepanek, who has the adult-onset form of Mattie's disease and who lost Mattie's three older siblings to it, wrote down the poems. In 2002, he served as the Muscular Dystrophy Association's national goodwill ambassador, a position he kept until he died, and he appeared on the "Jerry Lewis MDA Telethon" three times. Lewis planned to attend yesterday's funeral but illness kept him away, organizers said.

Such serious endeavors didn't mean Mattie was always a serious boy. Included in the montage was a large picture of his bespectacled, impish face superimposed on Austin Powers's hipster body, posing beside model and actress Elizabeth Hurley.

Indeed, this boy who worried about peace and death and the meaning of life also possessed a wild, prankster's sense of humor, said Murray M. Pollack, chairman of the Division of Pediatric Services at Children's Hospital. "He really did put apple juice in the urine cup and then drink it," Pollack said. "He really did watch 'Ferris Bueller's Day Off' to get some inspiration. His remote-control whoopee cushion is with him now."

Pollack finished with Mattie's favorite line: "Always remember to play after every storm."

When the service ended, bagpipers played "Amazing Grace" and white-gloved firefighters lined the coffin's route out of the church and to a firetruck, where, draped with the blue United Nations flag, it would be borne to Mattie's grave at Gate of Heaven Cemetery in Silver Spring.

The firefighters -- who got to know Mattie, as did the Harley riders, through the Muscular Dystrophy Association -- saluted the boy's coffin, their faces stoic and their brows furrowed and jaws twitching.

Former president Jimmy Carter greets Mattie Stepanek's mother, Jeni, at St. Catherine Laboure Catholic Church. He gave the eulogy.Members of the Montgomery County Fire Department take Mattie Stepanek's coffin, covered with the blue United Nations flag, to Gate of Heaven Cemetery in Silver Spring.Ashley Proctor leans her head on Kathleen Harnandez's shoulder as they wait to enter the memorial service. They attended school with Mattie. Oprah Winfrey, who had Mattie on her show, spoke before the service.Mattie and Jimmy Carter met through the Make-a-Wish Foundation. "We formed an instantaneous bond," Carter said.