Obama sips his drink at the Washington Wizards basketball game against the Chicago Bulls on Friday

As teacher James Moultrie turned to his pupils and asked what the term "40 acres and a mule" meant, a freight train thundered past his classroom. Eager hands shot up, including that of Ty'Sheoma Bethea, the school's new celebrity since a letter she wrote featured in US president Barack Obama's maiden address to congress on Tuesday.


Any answers the 14-year-old and her classmates might have been about to give were stillborn. The teacher's question hung in the air as the train kept coming. For six long minutes it rattled the windows of the prefab classroom and shook the foundations of an adjoining 1890s schoolhouse. Finally, when the train had receded into the distance, a young boy piped up, explaining that 40 acres and a mule was the grant given to black slaves in South Carolina along with their freedom.


The trains are an everyday frustration here at JV Martin Junior High. The mile-long freight trains pass through the once-prosperous cotton town of Dillon six or seven times a day, sounding their lonesome hooters. The interruption does little to help the school's performance. But there are other more significant factors, such as extreme poverty and the fact that, without school meals – breakfast and lunch – many of the children would be suffering from malnutrition.


These problems, and the dilapidated state of schools in South Carolina's overwhelmingly black 'corridor of shame', are nothing new. But they have been thrown into sharp focus after Ty'Sheoma appeared alongside the First Lady on Tuesday night as the US president recounted her story to congress.


Ty'Sheoma's insistence set in chain a series of events that last week had America's media knocking on her door. She has been whisked out of school to have her hair done for a People magazine photo shoot and done countless interviews. A reality TV show has offered to revamp the school's entire kitchen. Now they are waiting for a call from Oprah.


It all started when the principal told them at school assembly that President Obama, who had twice visited the school on the campaign trail, was having difficulty persuading congress to include money for school improvements in the $787bn stimulus bill.


The 'Principal Specialist' for JV Martin Junior High is a fiercely determined 39-year-old called Amanda Burnette. She has huge challenges running the school. The lights flicker constantly and temperatures reach 100°F in the gym. It's so cold in winter that the children do not take off their coats.


After hearing the president mention the school at his first press conference, Burnette told the pupils that one of the best ways to help him help the school was to write to a representative in congress. Little did she expect her advice to be taken with such effectiveness.


Next morning, Ty'Sheoma asked to borrow 41 cents for a stamp. Burnette recalls that when she read the girl's letter aloud in the office, she and her staff members choked up. The letter describes the hardships of the school, which is so poorly funded that educational trips have been halted. She described how dust pours down from the ceiling when people move around in upstairs rooms.


"The floors have holes in them, but we have covered them with rugs," she wrote. "This is very unsafe for the students [who could] fall through the floor."


Ty'Sheoma plays on the school basketball team but complained that "sometimes we have to cancel our home games because the gym ceiling leaks". The 14-year-old recounted that when the lights go out, the pupils have to troop outside to a muddy field in all weather. "This is taking away from our learning period of the day," she wrote. She described how upsetting it was to see the teachers struggle to provide them with a good education.


"We are just students trying to become lawyers, doctors, congressmen like yourself, and one day presidents," she wrote. "We are not quitters," she concluded, helpfully adding her home phone number in case members of congress had any further questions.


The principal took it upon herself to get the letter into the president's hands and repeatedly called the White House. The letter was handed to Obama as he prepared to make a final pitch to congress for extra funding.


Fortunately, the president had learned about this particular school, built in 1896, from a 2005 documentary, Corridor of Shame, about the state of infrastructure on either side of South Carolina's north-south interstate highway. Funded by community leaders and charities, the film highlights evidence used in an ongoing battle in which 36 mostly poor, black school districts have taken legal action against the state for failing to provide "minimally adequate education" to all students.


The state's prominent black congressman, James Clyburn, is convinced racism is behind the decision to leave schools in such dilapidated conditions. A little over an hour's drive away from Dillon, in the wealthy resort town of Myrtle Beach, there are state-of-the-art, well-funded state schools and a tax base to support them. The pupils are mostly white.


Students represented in the lawsuit are 88.4% from 'minority' groups, compared to the state average of 48.1%. More than 75% scored below average on achievement tests, compared to 17.4% of all students statewide.


It was not like this when cotton was king in this part of South Carolina. That's what brought the family of Ben Bernanke, Federal Reserve chairman, to Dillon in the 1940s. He grew up in a prosperous family that ran a pharmacy. He played basketball on the same court where Ty'Sheoma plays, and watched school plays in the now-condemned auditorium. Like Ty'Sheoma he was an 'A' student, but that is where the similarities end. Ty'Sheoma's single mother is a welder and has just learned that her employer is going to lay her off within three months unless business picks up. She will not be able to afford the rent and the family intends to move in with relatives in Georgia.


So far, Bernanke has shown no interest in helping his alma mater. Emails and faxes to his office from Burnette have gone unanswered. He still has relatives in Dillon, and a few years ago was presented with the keys to the town. He will be back on Saturday of next week, when a section of highway is being named after him, and Burnette hopes to collar him then.


Ty'Sheoma's trip to Washington was one of the few times she has set foot outside Dillon, but her poise in the public glare impressed many. She explained how Michelle Obama, her companion last Tuesday night, had promised that "they will rebuild the school" one way or another. A word to Bernanke might help.