Not sure what you're asking, but perhaps this is it (from Dired+):
(defun diredp-root-directory-p (file)
"Return non-nil if FILE is a root directory."
(if (fboundp 'ange-ftp-root-dir-p)
(ange-ftp-root-dir-p (file-name-as-directory file))
;; This is essentially `ange-ftp-root-dir-p' applied to `file-name-as-directory'.
;; If `ange-ftp-root-dir-p' changes, update this code.
(or (and (eq system-type 'windows-nt)
(string-match-p "\\`[a-zA-Z]:[/\\]\\'" (file-name-as-directory file)))
(string= "/" file))))
Or if you really mean a child of the root then use
(diredp-root-directory-p (diredp-parent-dir FILE)). Here's
diredp-parent-dir (from Dired+):
(defun diredp-parent-dir (file &optional relativep)
"Return the parent directory of FILE, or nil if none.
Optional arg RELATIVEP non-nil means return a relative name, that is,
just the parent component."
(let ((parent (file-name-directory (directory-file-name (expand-file-name file))))
(setq relparent (file-name-nondirectory (directory-file-name parent))))
(and (not (equal parent file)) (or relparent parent))))