A Bronx high school went loco for singer Ricky Martin and a Brooklyn kindergartner pulled a joke on mayoral daughter Emma Bloomberg yesterday when the pair went back to class as principals for a day.

The pop star and the political progeny joined 1,200 other boldface names in the annual citywide event held by the nonprofit group PENCIL to meld the private sector with public schools.

“Ricky is the best principal we’ve ever had,” said Phane Made, an 18-year-old senior at Adlai Stevenson HS in The Bronx.

And the best dressed.

Martin, who was greeted by cops holding back screaming fans, sauntered into school in a black Gucci shirt and fashionably faded jeans. Martin signed autographs and was both playful and philosophical as he did a whirlwind tour through classes in the four-story building.

The teens swarmed out of classes and into the hallways to shower him with hugs and kisses.

“Good mooorrrnnning. This is your principal today,” Martin bellowed over the loudspeaker.

He apologized for stumbling over a few announcements, and then ad-libbed, “Guys, I hope you have a great weekend!”

“Knowledge is the key to eternal life,” said Martin, a graduate of a high school in Puerto Rico.

Meanwhile, just a few minutes into the school day at Bensonhurst’s PS 247, Emma Bloomberg faced 5-year-old heckler Daniel Chan, who told her she had something on her nose. Bloomberg’s eyes widened as her hand flew up to her face.

“April Fool!” Daniel chuckled. Kids showered Bloomberg, who works at City Hall, with colorful cards and poems – cleverly cloaking their agenda in a song.

“Say hello to your dad / We need help from him / If he’s not too busy / We could use a gym,” second-graders sang in their cramped lunchroom.

But most kids got a sudden attack of shyness when the unassuming Bloomberg walked into the room.

She was asked her age (22), her marital status (single), what she does all day (a lot of research) and, from one well-informed third-grader, if she’s rich (“Me personally? No”).

Bloomberg plopped on the floor with first-graders to sing “Baby Beluga,” a Raffi song she said her younger sister Georgina used to play.”I forgot how fun it is to be little,” she said after playing trains with a class of pre-kindergartners.